offers: split offer send_invoice generation into new JSON command

We split `send_invoice` offers inoo offerout (for want of a better name).
This simplifies the API.

Also took the opportunity to move the `vendor` tag to immediately
follow `description` (our tests use arguments by keywords, so no
change there).

Suggested-by: shesek
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-01-08 05:16:47 +10:30
parent 47ce7ff0c1
commit 1aa7e8e011
10 changed files with 330 additions and 85 deletions

View File

@@ -3991,9 +3991,8 @@ def test_sendinvoice(node_factory, bitcoind):
l1, l2 = node_factory.line_graph(2, wait_for_announce=True)
# Simple offer to send money (balances channel a little)
offer = l1.rpc.call('offer', {'amount': '100000sat',
'description': 'simple test',
'send_invoice': True})['bolt12']
offer = l1.rpc.call('offerout', {'amount': '100000sat',
'description': 'simple test'})['bolt12']
print(offer)
# Fetchinvoice will refuse, since you're supposed to send an invoice.
@@ -4019,9 +4018,9 @@ def test_sendinvoice(node_factory, bitcoind):
inv = l1.rpc.call('fetchinvoice', {'offer': offer})
l1.rpc.pay(inv['invoice'])
refund = l2.rpc.call('offer', {'amount': '100msat',
'description': 'refund test',
'refund_for': inv['invoice']})['bolt12']
refund = l2.rpc.call('offerout', {'amount': '100msat',
'description': 'refund test',
'refund_for': inv['invoice']})['bolt12']
l1.rpc.call('sendinvoice', {'offer': refund,
'label': 'test sendinvoice refund'})