From 34604f62145f59a497f5807ab3b46977f3dea122 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 26 Sep 2017 17:57:20 -0700 Subject: [PATCH] lnwallet: properly use the p2wkh script in SignDesc for retributions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes a minor bug (that doesn’t affect anything atm) when crafting the SignDesc for sweeping breached outputs. Previously, we would take the p2wkh script and then p2wsh-ify that, placing that into the SignDesc. This is incorrect as the p2wkh script is “injected” into the sighash when signing, and thus doesn’t need another encoding layer. --- lnwallet/channel.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 3f7f0a9a..3968834a 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -1147,10 +1147,6 @@ func newBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64, if err != nil { return nil, err } - localWitnessHash, err := witnessScriptHash(localPkScript) - if err != nil { - return nil, err - } // In order to fully populate the breach retribution struct, we'll need // to find the exact index of the local+remote commitment outputs. @@ -1194,7 +1190,7 @@ func newBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64, PubKey: chanState.LocalChanCfg.PaymentBasePoint, WitnessScript: localPkScript, Output: &wire.TxOut{ - PkScript: localWitnessHash, + PkScript: localPkScript, Value: int64(localAmt), }, HashType: txscript.SigHashAll,