invoice: add ctlv option.

This is required if we want to create a "bouncer" plugin (in my copious free time!)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `invoice` now takes an optional `cltv` parameter.
This commit is contained in:
Rusty Russell
2021-01-08 15:13:50 +10:30
committed by Christian Decker
parent 4b2efd69d7
commit 1a8978100e
5 changed files with 23 additions and 6 deletions

View File

@@ -30,6 +30,7 @@ def test_invoice(node_factory, chainparams):
assert b11['fallbacks'][0]['type'] == 'P2WPKH'
assert b11['fallbacks'][1]['addr'] == addr2
assert b11['fallbacks'][1]['type'] == 'P2SH'
assert b11['min_final_cltv_expiry'] == 5
# There's no incoming channel, so no routeboost
assert 'routes' not in b11
assert 'warning_capacity' in inv
@@ -58,6 +59,11 @@ def test_invoice(node_factory, chainparams):
l2.rpc.invoice(4294967295 + 1, 'inv3', '?')
l2.rpc.invoice(4294967295, 'inv3', '?')
# Test cltv option.
inv = l1.rpc.invoice(123000, 'label3', 'description', '3700', cltv=99)
b11 = l1.rpc.decodepay(inv['bolt11'])
assert b11['min_final_cltv_expiry'] == 99
def test_invoice_zeroval(node_factory):
"""A zero value invoice is unpayable, did you mean 'any'?"""