From ce338dc88fc81678e987c5f5fd900abd1cf6cfef Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 21 Jul 2021 15:08:14 +0930 Subject: [PATCH] offerout: don't insist that invoice vendor match our vendor. This was a bug in the spec, actually. Reported-by: @shesek Signed-off-by: Rusty Russell Fixes: #4666 --- plugins/offers_inv_hook.c | 4 ---- tests/test_pay.py | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/plugins/offers_inv_hook.c b/plugins/offers_inv_hook.c index 1752f78e1..caba93f69 100644 --- a/plugins/offers_inv_hook.c +++ b/plugins/offers_inv_hook.c @@ -229,15 +229,11 @@ static struct command_result *listoffers_done(struct command *cmd, * or unset exactly as they are in the `offer`: * - `refund_for` * - `description` - * - `vendor` */ err = inv_must_equal_offer(cmd, inv, refund_for); if (err) return err; err = inv_must_equal_offer(cmd, inv, description); - if (err) - return err; - err = inv_must_equal_offer(cmd, inv, vendor); if (err) return err; diff --git a/tests/test_pay.py b/tests/test_pay.py index 678810885..8108b67c4 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -4452,6 +4452,27 @@ def test_sendinvoice(node_factory, bitcoind): 'label': 'test sendinvoice refund'}) wait_for(lambda: only_one(l2.rpc.call('listoffers', [refund['offer_id']])['offers'])['used'] is True) + # Offer with vendor: we must not copy vendor into our invoice! + offer = l1.rpc.call('offerout', {'amount': '10000sat', + 'description': 'simple test', + 'vendor': "clightning test suite"}) + + out = l2.rpc.call('sendinvoice', {'offer': offer['bolt12'], + 'label': 'test sendinvoice 3'}) + assert out['label'] == 'test sendinvoice 3' + assert out['description'] == 'simple test' + assert 'vendor' not in out + assert 'bolt12' in out + assert 'payment_hash' in out + assert out['status'] == 'paid' + assert 'payment_preimage' in out + assert 'expires_at' in out + assert out['msatoshi'] == 10000000 + assert out['amount_msat'] == Millisatoshi(10000000) + assert 'pay_index' in out + assert out['msatoshi_received'] == 10000000 + assert out['amount_received_msat'] == Millisatoshi(10000000) + def test_self_pay(node_factory): """Repro test for issue 4345: pay ourselves via the pay plugin.