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.
This commit is contained in:
Christian Decker 2020-08-09 15:26:46 +02:00
parent 0279be1d13
commit 8769f9ed93
2 changed files with 4 additions and 3 deletions

View File

@ -1076,6 +1076,7 @@ static void payment_add_hop_onion_payload(struct payment *p,
u32 cltv = p->start_block + next->delay + 1; u32 cltv = p->start_block + next->delay + 1;
u64 msat = next->amount.millisatoshis; /* Raw: TLV payload generation*/ u64 msat = next->amount.millisatoshis; /* Raw: TLV payload generation*/
struct tlv_field **fields; struct tlv_field **fields;
struct payment *root = payment_root(p);
static struct short_channel_id all_zero_scid = {.u64 = 0}; static struct short_channel_id all_zero_scid = {.u64 = 0};
/* This is the information of the node processing this payload, while /* 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) { if (payment_secret != NULL) {
assert(final); assert(final);
tlvstream_set_tlv_payload_data(fields, payment_secret, tlvstream_set_tlv_payload_data(
msat); fields, payment_secret,
root->amount.millisatoshis); /* Raw: TLV payload generation*/
} }
break; break;
} }

View File

@ -3308,7 +3308,6 @@ def test_listpays_ongoing_attempt(node_factory, bitcoind, executor):
l1.rpc.listpays() l1.rpc.listpays()
@pytest.mark.xfail(strict=True)
@unittest.skipIf(not DEVELOPER, "needs use_shadow") @unittest.skipIf(not DEVELOPER, "needs use_shadow")
def test_mpp_waitblockheight_routehint_conflict(node_factory, bitcoind, executor): def test_mpp_waitblockheight_routehint_conflict(node_factory, bitcoind, executor):
''' '''