Update outdated BOLT quotes bolt12.c: - quote update on `bolt12_chains_match`; - add a new condition to `offer_decode` to check if the amount is greater than 0;
What changed, and why it matters
This commit only changes test files and BOLT specification comment quotes. It updates test expectations and comment text to match a newer version of the BOLT #12 standard, but does not change any production code that validates offer amounts. There is no security-relevant code change visible in the supplied diff.
No action required for security. If reviewing the full commit, verify that any production changes in bolt12.c or bolt12-cli.c correctly enforce the new BOLT #12 requirement that offer_amount must be greater than zero.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies two test files under common/test/. In run-bolt-12-encode-test.c it adjusts a test case so that an offer with a valid positive offer_amount (10000) but no offer_description is now expected to be invalid for the description reason alone, and then separately tests invalid offer_amount. In run-bolt12-format-string-test.c it updates a BOLT quote comment. The commit message mentions bolt12.c and bolt12-cli.c changes, but those files are not present in the supplied diff, so no production validation logic can be assessed. The visible changes are test-only and comment-only.
Changed components
common/test/run-bolt-12-encode-test.ccommon/test/run-bolt12-format-string-test.cInspect captured patch +6 / −3
diff --git a/common/test/run-bolt12-encode-test.c b/common/test/run-bolt12-encode-test.c
index aff41967..4692c5b8 100644
--- a/common/test/run-bolt12-encode-test.c
+++ b/common/test/run-bolt12-encode-test.c
@@ -429,15 +429,18 @@ int main(int argc, char *argv[])
/* BOLT #12:
* - if `offer_amount` is set and `offer_description` is not set:
* - MUST NOT respond to the offer.
- * - if `offer_amount` is set and is not greater than zero:
+ * - if `offer_amount` is set and is not greater than zero:
* - MUST NOT respond to the offer.
* - if `offer_currency` is set and `offer_amount` is not set:
* - MUST NOT respond to the offer.
* - if neither `offer_issuer_id` nor `offer_paths` are set:
* - MUST NOT respond to the offer.
*/
+ offer->offer_amount = tal(offer, u64);
+ *offer->offer_amount = 10000;
+
offer->offer_description = NULL;
- print_invalid_offer(offer, "Missing offer_description and offer_amount");
+ print_invalid_offer(offer, "Missing offer_description");
offer->offer_description = tal_utf8(tmpctx, "Test vectors");
offer->offer_amount = tal(offer, u64);
diff --git a/common/test/run-bolt12-format-string-test.c b/common/test/run-bolt12-format-string-test.c
index 10f6748b..d861b3aa 100644
--- a/common/test/run-bolt12-format-string-test.c
+++ b/common/test/run-bolt12-format-string-test.c
@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
* - SHOULD omit `offer_chains`, implying that bitcoin is only chain.
* - if a specific minimum `offer_amount` is required for successful payment:
* - MUST set `offer_amount` to the amount expected (per item).
- * - MUST set `offer_amount` greater than zero.
+ * - MUST set `offer_amount` greater than zero.
* - if the currency for `offer_amount` is that of all entries in `chains`:
* - MUST specify `offer_amount` in multiples of the minimum lightning-payable unit
* (e.g. milli-satoshis for bitcoin).
Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.