mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-03 10:12:28 +02:00
lnwallet/channel: reuse derived SingleTweak on local force close
When creating the keyring, the tweak is already calculated in the remote commitment case. We add the calculation also for our own commitment, so we can use it in all cases without deriving the tweak.
This commit is contained in:
@@ -96,13 +96,20 @@ func DeriveCommitmentKeys(commitPoint *btcec.PublicKey,
|
||||
|
||||
tweaklessCommit := chanType.IsTweakless()
|
||||
|
||||
// Depending on if this is our commit or not, we'll choose the correct
|
||||
// base point.
|
||||
localBasePoint := localChanCfg.PaymentBasePoint
|
||||
if isOurCommit {
|
||||
localBasePoint = localChanCfg.DelayBasePoint
|
||||
}
|
||||
|
||||
// First, we'll derive all the keys that don't depend on the context of
|
||||
// whose commitment transaction this is.
|
||||
keyRing := &CommitmentKeyRing{
|
||||
CommitPoint: commitPoint,
|
||||
|
||||
LocalCommitKeyTweak: input.SingleTweakBytes(
|
||||
commitPoint, localChanCfg.PaymentBasePoint.PubKey,
|
||||
commitPoint, localBasePoint.PubKey,
|
||||
),
|
||||
LocalHtlcKeyTweak: input.SingleTweakBytes(
|
||||
commitPoint, localChanCfg.HtlcBasePoint.PubKey,
|
||||
|
Reference in New Issue
Block a user