pytest: test for offer failing decode when empty description.

In particular, Shesek tried an empty offer description, and the
resulting signature didn't match since it was omitted entirely from
the bolt12 string!

Reported-by: @shesek
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2021-07-21 15:08:20 +09:30 committed by neil saitug
parent ce338dc88f
commit 1eb7edb0bb

View file

@ -3923,10 +3923,15 @@ def test_offer_needs_option(node_factory):
l1.rpc.call('fetchinvoice', {'offer': 'aaaa'})
@pytest.mark.xfail(strict=True)
def test_offer(node_factory, bitcoind):
plugin = os.path.join(os.path.dirname(__file__), 'plugins/currencyUSDAUD5000.py')
l1 = node_factory.get_node(options={'plugin': plugin, 'experimental-offers': None})
# Try empty description
ret = l1.rpc.call('offer', [9, ''])
l1.rpc.decode(ret['bolt12'])
bolt12tool = os.path.join(os.path.dirname(__file__), "..", "devtools", "bolt12-cli")
# Try different amount strings
for amount in ['1msat', '0.1btc', 'any', '1USD', '1.10AUD']: