lnwallet: properly use the p2wkh script in SignDesc for retributions

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.
This commit is contained in:
Olaoluwa Osuntokun 2017-09-26 17:57:20 -07:00
parent 1d487ea78b
commit 34604f6214
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

View File

@ -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,