lnwallet+contractcourt: publicly export DeriveCommitmentKeys use in chain watcher
In this commit, we consolidate the number of areas where we derive our commitment keys. Before this commit, the `isOurCommitment` function in the chain watcher used a custom routine to derive the expected scripts/keys for our commitment at that height. With the recent changes, we now have additional logic in `DeriveCommitmentKeys` that wasn't copied over to this area. As a result, the prior logic would erroneously detect if it was our commitment that had hit the chain or not. In this commit, we remove the old custom code, and use `DeriveCommitmentKeys` wihtin the chain watcher as well. This ensures that we only need to maintain the key derivation code in a single place, preventing future bugs of this nature.
This commit is contained in:
3 files changed
+36
-40
No files matched your search
+2
-2
@@ -663,11 +663,11 @@ func CreateCommitmentTxns(localBalance, remoteBalance btcutil.Amount,
|
||||
fundingTxIn wire.TxIn,
|
||||
tweaklessCommit bool) (*wire.MsgTx, *wire.MsgTx, error) {
|
||||
|
||||
localCommitmentKeys := deriveCommitmentKeys(
|
||||
localCommitmentKeys := DeriveCommitmentKeys(
|
||||
localCommitPoint, true, tweaklessCommit, ourChanCfg,
|
||||
theirChanCfg,
|
||||
)
|
||||
remoteCommitmentKeys := deriveCommitmentKeys(
|
||||
remoteCommitmentKeys := DeriveCommitmentKeys(
|
||||
remoteCommitPoint, false, tweaklessCommit, ourChanCfg,
|
||||
theirChanCfg,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user