Expose revokeable output index and building a justice tx from commitment
authorAlec Chen <alecchendev@gmail.com>
Tue, 11 Jul 2023 22:15:11 +0000 (17:15 -0500)
committerAlec Chen <alecchendev@gmail.com>
Wed, 23 Aug 2023 17:33:08 +0000 (12:33 -0500)
commit04475c809ef0258a63a45aa3df48585d53110a66
treeb6bf50112a6253f55ccadf966ce1e9f56d6d4189
parent75c058670cdfd2db97102d70d869757a77f1ac04
Expose revokeable output index and building a justice tx from commitment

For watchtowers to be able to build justice transactions for our
counterparty's revoked commitments, they need to be able to find the
revokeable output for them to sweep. Here we cache `to_self_delay` in
`CommitmentTransaction` to allow for finding this output on the struct
directly. We also add a simple helper method to aid in building the
initial spending transaction.

This also adds a unit test for both of these helpers, and
refactors a bit of a previous `CommitmentTransaction` unit test to make
adding these easier.
lightning/src/ln/chan_utils.rs