mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-04 06:44:24 +01:00
pytest: finally test fetchinvoice send, and offer plugin receive.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
69ddf818c7
commit
2baa410e2b
@@ -3842,3 +3842,27 @@ def test_offer(node_factory, bitcoind):
|
||||
output = subprocess.check_output([bolt12tool, 'decode',
|
||||
offer['bolt12']]).decode('UTF-8')
|
||||
assert 'recurrence: every 600 seconds paywindow -10 to +600 (pay proportional)\n' in output
|
||||
|
||||
|
||||
@unittest.skipIf(not EXPERIMENTAL_FEATURES, "offers are experimental")
|
||||
def test_fetchinvoice(node_factory, bitcoind):
|
||||
l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True)
|
||||
|
||||
# Simple offer first.
|
||||
offer = l3.rpc.call('offer', {'amount': '1msat',
|
||||
'description': 'simple test'})['bolt12']
|
||||
print(offer)
|
||||
|
||||
inv1 = l1.rpc.call('fetchinvoice', {'offer': offer})
|
||||
inv2 = l1.rpc.call('fetchinvoice', {'offer': offer})
|
||||
assert inv1 != inv2
|
||||
|
||||
# Single-use invoice can be fetched multiple times, only paid once.
|
||||
offer = l3.rpc.call('offer', {'amount': '1msat',
|
||||
'description': 'single-use test',
|
||||
'single_use': True})['bolt12']
|
||||
print(offer)
|
||||
|
||||
inv1 = l1.rpc.call('fetchinvoice', {'offer': offer})
|
||||
inv2 = l1.rpc.call('fetchinvoice', {'offer': offer})
|
||||
assert inv1 != inv2
|
||||
|
||||
Reference in New Issue
Block a user