Use onion amount `amt_to_forward` for MPP set calculation
authorAlec Chen <alecchendev@gmail.com>
Tue, 7 Mar 2023 01:51:44 +0000 (19:51 -0600)
committerAlec Chen <alecchendev@gmail.com>
Tue, 28 Mar 2023 22:21:09 +0000 (17:21 -0500)
commit1d31b0e84e2adeb774f4e626c240337c65cb411c
treede2c33ae756dbf43cc761bbe3fbcb20eda4e7e1b
parentee57738ca8564a31d9f919bd4b642d1449bd61a1
Use onion amount `amt_to_forward` for MPP set calculation

If routing nodes take less fees and pay the final node more than
`amt_to_forward`, the receiver may see that `total_msat` has been met
before all of the sender's intended HTLCs have arrived. The receiver
may then prematurely claim the payment and release the payment hash,
allowing routing nodes to claim the remaining HTLCs. Using the onion
value `amt_to_forward` to determine when `total_msat` has been met
allows the sender to control the set total.
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_tests.rs