From 8769f9ed9353138fd88407fa6904483665a043d0 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Sun, 9 Aug 2020 15:26:46 +0200 Subject: [PATCH] pay: Fix final TLV payload if not going through MPP modifiers Reported-by: ZmnSCPxj Signed-off-by: Christian Decker <@cdecker> Changelog-Fixed: pay: Correct a case where we put the sub-payment value instead of the *total* value in the `total_msat` field of a multi-part payment. --- plugins/libplugin-pay.c | 6 ++++-- tests/test_pay.py | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index c735fc8c0..15ecef8b4 100644 --- a/plugins/libplugin-pay.c +++ b/plugins/libplugin-pay.c @@ -1076,6 +1076,7 @@ static void payment_add_hop_onion_payload(struct payment *p, u32 cltv = p->start_block + next->delay + 1; u64 msat = next->amount.millisatoshis; /* Raw: TLV payload generation*/ struct tlv_field **fields; + struct payment *root = payment_root(p); static struct short_channel_id all_zero_scid = {.u64 = 0}; /* This is the information of the node processing this payload, while @@ -1111,8 +1112,9 @@ static void payment_add_hop_onion_payload(struct payment *p, if (payment_secret != NULL) { assert(final); - tlvstream_set_tlv_payload_data(fields, payment_secret, - msat); + tlvstream_set_tlv_payload_data( + fields, payment_secret, + root->amount.millisatoshis); /* Raw: TLV payload generation*/ } break; } diff --git a/tests/test_pay.py b/tests/test_pay.py index 4171adaa8..5995e40b9 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -3308,7 +3308,6 @@ def test_listpays_ongoing_attempt(node_factory, bitcoind, executor): l1.rpc.listpays() -@pytest.mark.xfail(strict=True) @unittest.skipIf(not DEVELOPER, "needs use_shadow") def test_mpp_waitblockheight_routehint_conflict(node_factory, bitcoind, executor): '''