Handle `transaction_unconfirmed` as a full reorg to the tx height 2022-11-more-robust-unconfirmed
authorMatt Corallo <git@bluematt.me>
Thu, 10 Nov 2022 01:01:31 +0000 (01:01 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 18 Nov 2022 20:49:44 +0000 (20:49 +0000)
commit66d7b7ded0657f99ffbc4f4a69eab2d13b3a3515
treea26c748b2c9658105dd430e428fa6de884e56c2c
parent384c4dc7753e4b7ac53ea380e52809babd8f0f9b
Handle `transaction_unconfirmed` as a full reorg to the tx height

In `ChannelMonitor`, if we see a `transaction_unconfirmed` for a
transaction we last saw in a block at height X, we shouldn't
*only* remove the `onchain_events_awaiting_threshold_conf` entry
for the given tx but rather for all transactions that we last saw
at height >= X.

This avoids any potential `onchain_events_awaiting_threshold_conf`
inconsistencies due to the order in whcih users mark transactions
unconfirmed (which the `chain::Confirm` docs do not currently set
any requirements on).

This also matches the `OnchainTxHandler` behavior, which does the
same lookup.
lightning/src/chain/channelmonitor.rs