Refactor payment-claim logic to ensure MPP-claim atomicity
authorMatt Corallo <git@bluematt.me>
Mon, 30 Mar 2020 20:24:19 +0000 (16:24 -0400)
committerMatt Corallo <git@bluematt.me>
Wed, 15 Apr 2020 00:50:41 +0000 (20:50 -0400)
commita93d6e905b83a850bb5ba9ad649ffa0903fb19d1
tree62b94573bc624f794f8f33d8945da087613098bc
parent5260e81033c6008fdcef1cbf973243268f4ca373
Refactor payment-claim logic to ensure MPP-claim atomicity

Previously if we claimed an MPP where a previous-hop channel was
closed while we were waitng for the user to provide us the preimage
we'd simply skip claiming that HTLC without letting the user know.

This refactors the claim logic to first check that all the channels
are still available (which is actually all we need - we really
mostly care about updating the channel monitors, not the channels
themselves) and then claim the HTLCs in the same lock, ensuring
atomicity.
lightning/src/ln/chanmon_update_fail_tests.rs
lightning/src/ln/channelmanager.rs