]> git.bitcoin.ninja Git - rust-lightning/commit
Ensure `transactions_confirmed` is idempotent
authorMatt Corallo <git@bluematt.me>
Fri, 18 Nov 2022 18:54:16 +0000 (18:54 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 24 Nov 2022 03:40:48 +0000 (03:40 +0000)
commit21804de70c3ff37970ead98e5e72c4fccd14b1fb
tree9746b8bcf2abe2107897c29efd71e9fc6d88a5f2
parent537e91cb1ec4ef65728e3fdda5eb5e2e19fd91c8
Ensure `transactions_confirmed` is idempotent

In many complexity-reduced implementations of chain syncing using
esplora `transactions_confirmed` may be called redundantly for
transactions which were already confirmed. To ensure this is
idempotent we add two new `ConnectionStyle`s in our tests which
(a) call `transactions_confirmed` twice for each call, ensuring
simple idempotency is ensured and (b) call `transactions_confirmed`
once for each historical block every time we're connecting a new
block, ensuring we're fully idempotent even if every call is
repeated constantly.

In order to actually behave correctly this requires a simple
already-confirmed check in `ChannelMonitor`, which is included.
lightning/src/chain/channelmonitor.rs
lightning/src/ln/functional_test_utils.rs
lightning/src/ln/functional_tests.rs
lightning/src/ln/payment_tests.rs