input: pass input.Signature to multisig spend

Modifies SpendMultiSig to accept input.Signature, so that we can
ultimately assert the size of multisig witnesses.
This commit is contained in:
Conner Fromknecht committed 2020-04-10 14:27:35 -07:00
1 parent 0f94b8dc62
commit f2b6e2af04
6 files changed
+87 -50

No files matched your search

+16 -2
View File
@@ -98,7 +98,7 @@ func newChannelTestCtx(chanSize int64) (*channelTestCtx, error) {
}
sigHashes := txscript.NewTxSigHashes(commitTx)
aliceSig, err := txscript.RawTxInWitnessSignature(
aliceSigRaw, err := txscript.RawTxInWitnessSignature(
commitTx, sigHashes, 0, chanSize,
multiSigScript, txscript.SigHashAll, alicePriv,
)
@@ -106,7 +106,14 @@ func newChannelTestCtx(chanSize int64) (*channelTestCtx, error) {
return nil, err
}
bobSig, err := txscript.RawTxInWitnessSignature(
aliceSig, err := btcec.ParseDERSignature(
aliceSigRaw, btcec.S256(),
)
if err != nil {
return nil, err
}
bobSigRaw, err := txscript.RawTxInWitnessSignature(
commitTx, sigHashes, 0, chanSize,
multiSigScript, txscript.SigHashAll, bobPriv,
)
@@ -114,6 +121,13 @@ func newChannelTestCtx(chanSize int64) (*channelTestCtx, error) {
return nil, err
}
bobSig, err := btcec.ParseDERSignature(
bobSigRaw, btcec.S256(),
)
if err != nil {
return nil, err
}
commitTx.TxIn[0].Witness = input.SpendMultiSig(
multiSigScript, alicePub.SerializeCompressed(), aliceSig,
bobPub.SerializeCompressed(), bobSig,