Update `ChannelMonitor::best_block` before calling block_confirmed
authorMatt Corallo <git@bluematt.me>
Mon, 28 Jun 2021 16:23:19 +0000 (16:23 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 2 Jul 2021 17:16:12 +0000 (17:16 +0000)
commit599c74cd427592c318f90bf0cc91ad88dc14bc06
tree6af1d9e59b1b03d99febbb70dffe5ca9bb3baa7f
parent697033342e3f5cb8bb524843c409ede8a39368c1
Update `ChannelMonitor::best_block` before calling block_confirmed

No matter the context, if we're told about a block which is
guaranteed by our API semantics to be on the best chain, and it has
a higher height than our current understanding of the best chain,
we should update our understanding. This avoids complexity
in `block_confirmed` by never having a height set which is *higher*
than our current best chain, potentially avoiding some bugs in the
rather-complicated code.

It also requires a minor test tweak as we in some cases now no
longer broadcast a conflicting transaction after the original has
reached the ANTI_REORG_DELAY.
lightning/src/chain/channelmonitor.rs
lightning/src/ln/functional_tests.rs