Enable monitor to rebuild initial counterparty commitment tx
authorAlec Chen <alecchendev@gmail.com>
Wed, 12 Jul 2023 18:14:10 +0000 (13:14 -0500)
committerAlec Chen <alecchendev@gmail.com>
Wed, 23 Aug 2023 17:33:07 +0000 (12:33 -0500)
commit75c058670cdfd2db97102d70d869757a77f1ac04
tree593cd33879ee1e9ec26069a3c58b51b5c1dc7775
parent966465a282f91a91ec8b058a0dea5f7b0c6bf21c
Enable monitor to rebuild initial counterparty commitment tx

Upon creating a channel monitor, it is provided with the initial
counterparty commitment transaction info directly before the very first
time it is persisted. Because of this, the very first counterparty
commitment is not seen as an update in the persistence pipeline, and so
our previous changes to the monitor and updates cannot be used to
reconstruct this commitment.

To be able to expose the counterparty's transaction for the very first
commitment, we add a thin wrapper around
`provide_latest_counterparty_commitment_tx`, that stores the necessary
data needed to reconstruct the initial commitment transaction in the
monitor.
lightning/src/chain/channelmonitor.rs
lightning/src/ln/channel.rs