lnwallet: use channel type to derive remote script
Based on the current channel type, we derive the script used for the to_remote output. Currently only the unencumbered p2wkh type is used, but that will change with upcoming channel types.
This commit is contained in:
5 files changed
+105
-62
No files matched your search
@@ -351,8 +351,9 @@ func isOurCommitment(localChanCfg, remoteChanCfg channeldb.ChannelConfig,
|
||||
|
||||
// With the keys derived, we'll construct the remote script that'll be
|
||||
// present if they have a non-dust balance on the commitment.
|
||||
remotePkScript, err := input.CommitScriptUnencumbered(
|
||||
commitKeyRing.ToRemoteKey,
|
||||
remoteDelay := uint32(remoteChanCfg.CsvDelay)
|
||||
remoteScript, err := lnwallet.CommitScriptToRemote(
|
||||
chanType, remoteDelay, commitKeyRing.ToRemoteKey,
|
||||
)
|
||||
if err != nil {
|
||||
return false, err
|
||||
@@ -383,7 +384,7 @@ func isOurCommitment(localChanCfg, remoteChanCfg channeldb.ChannelConfig,
|
||||
case bytes.Equal(localPkScript, pkScript):
|
||||
return true, nil
|
||||
|
||||
case bytes.Equal(remotePkScript, pkScript):
|
||||
case bytes.Equal(remoteScript.PkScript, pkScript):
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user