]> git.bitcoin.ninja Git - rust-lightning/commit
Always return failure in `update_monitor` after funding spend
authorMatt Corallo <git@bluematt.me>
Sun, 17 Oct 2021 21:28:50 +0000 (21:28 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 6 Dec 2021 18:39:37 +0000 (18:39 +0000)
commit25542b8157e95e362e097b73a366da3f8bfe962d
tree6a7569455ebab95578e829be10df48a970f2e81d
parent37c6c18789151b2a8c7c3b7e4c1d98f7f86e906a
Always return failure in `update_monitor` after funding spend

Previously, monitor updates were allowed freely even after a
funding-spend transaction confirmed. This would allow a race
condition where we could receive a payment (including the
counterparty revoking their broadcasted state!) and accept it
without recourse as long as the ChannelMonitor receives the block
first, the full commitment update dance occurs after the block is
connected, and before the ChannelManager receives the block.

Obviously this is an incredibly contrived race given the
counterparty would be risking their full channel balance for it,
but its worth fixing nonetheless as it makes the potential
ChannelMonitor states simpler to reason about.

The test in this commit also tests the behavior changed in the
previous commit.
lightning/src/chain/channelmonitor.rs
lightning/src/util/test_utils.rs