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;
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;
}