mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 22:50:58 +02:00
lnwallet: coalesce different supported output scripts into single method
This commit is contained in:
committed by
Olaoluwa Osuntokun
parent
652f841738
commit
01e9bb2bff
@@ -372,19 +372,14 @@ func (c *chainWatcher) handleUnknownLocalState(
|
||||
// Next, we'll derive our script that includes the revocation base for
|
||||
// the remote party allowing them to claim this output before the CSV
|
||||
// delay if we breach.
|
||||
localScript, err := input.CommitScriptToSelf(
|
||||
uint32(c.cfg.chanState.LocalChanCfg.CsvDelay),
|
||||
localScript, err := lnwallet.CommitScriptToSelf(
|
||||
commitKeyRing.ToLocalKey, commitKeyRing.RevocationKey,
|
||||
uint32(c.cfg.chanState.LocalChanCfg.CsvDelay),
|
||||
)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
localPkScript, err := input.WitnessScriptHash(localScript)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
// With all our scripts assembled, we'll examine the outputs of the
|
||||
// commitment transaction to determine if this is a local force close
|
||||
// or not.
|
||||
@@ -393,7 +388,7 @@ func (c *chainWatcher) handleUnknownLocalState(
|
||||
pkScript := output.PkScript
|
||||
|
||||
switch {
|
||||
case bytes.Equal(localPkScript, pkScript):
|
||||
case bytes.Equal(localScript.PkScript, pkScript):
|
||||
ourCommit = true
|
||||
|
||||
case bytes.Equal(remoteScript.PkScript, pkScript):
|
||||
|
Reference in New Issue
Block a user