pytest: test for amountless offer with currency.
What changed, and why it matters
This commit only adds a new pytest test case. The test is marked as expected to fail (xfail) and checks that decoding a specific kind of Lightning offer (one with a currency but no amount) is correctly rejected as invalid. It does not change any production code, fix a bug, or introduce a vulnerability. It is a test addition tied to an ongoing BOLT specification discussion.
No security action needed. This is a test-only commit. Review the referenced BOLT PR 1279 for specification context if desired.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds a single test function, test_offer_currency_no_amount, in tests/test_pay.py. It uses pytest.mark.xfail(strict=True) to assert that decoding an amountless offer containing a currency field should fail (ret[‘valid’] is False). The test references BOLTS PR 1279, indicating this behavior is under specification review. No implementation code is modified.
Changed components
tests/test_pay.pyInspect captured patch +7 / −0
diff --git a/tests/test_pay.py b/tests/test_pay.py
index de53bb3c..8fb2a83c 100644
--- a/tests/test_pay.py
+++ b/tests/test_pay.py
@@ -7170,3 +7170,10 @@ def test_invoice_amount_override(node_factory):
l1.rpc.sendpay(route, inv["payment_hash"], payment_secret=inv["payment_secret"])
assert l1.rpc.waitsendpay(inv["payment_hash"])["status"] == "complete"
+
+
+@pytest.mark.xfail(strict=True)
+def test_offer_currency_no_amount(node_factory):
+ l1 = node_factory.get_node()
+ ret = l1.rpc.decode("lno1qcp4256ypgx9getnwss8vetrw3hhyuckyypwa3eyt44h6txtxquqh7lz5djge4afgfjn7k4rgrkuag0jsd5xvxg")
+ assert ret['valid'] is False
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.