mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-03 10:12:28 +02:00
input: introduce Signature iface
This commit introduces the Signature interface which will be used by our witness construction methods instead of passing in raw byte slices. This will be used later to inject various kinds of mock signatures, e.g. 73-byte signatures for simulating worst-case witness weight.
This commit is contained in:
@@ -226,7 +226,7 @@ func TestHTLCSenderSpendValidation(t *testing.T) {
|
||||
htlcOutput *wire.TxOut
|
||||
sweepTxSigHashes *txscript.TxSigHashes
|
||||
senderCommitTx, sweepTx *wire.MsgTx
|
||||
bobRecvrSig []byte
|
||||
bobRecvrSig *btcec.Signature
|
||||
bobSigHash txscript.SigHashType
|
||||
)
|
||||
|
||||
@@ -303,10 +303,15 @@ func TestHTLCSenderSpendValidation(t *testing.T) {
|
||||
SigHashes: sweepTxSigHashes,
|
||||
InputIndex: 0,
|
||||
}
|
||||
bobRecvrSig, err = bobSigner.SignOutputRaw(sweepTx, &bobSignDesc)
|
||||
bobSigBytes, err := bobSigner.SignOutputRaw(sweepTx, &bobSignDesc)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to generate alice signature: %v", err)
|
||||
}
|
||||
|
||||
bobRecvrSig, err = btcec.ParseDERSignature(bobSigBytes, btcec.S256())
|
||||
if err != nil {
|
||||
t.Fatalf("unable to parse signature: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
testCases := []struct {
|
||||
@@ -622,7 +627,7 @@ func TestHTLCReceiverSpendValidation(t *testing.T) {
|
||||
htlcOutput *wire.TxOut
|
||||
receiverCommitTx, sweepTx *wire.MsgTx
|
||||
sweepTxSigHashes *txscript.TxSigHashes
|
||||
aliceSenderSig []byte
|
||||
aliceSenderSig *btcec.Signature
|
||||
aliceSigHash txscript.SigHashType
|
||||
)
|
||||
|
||||
@@ -695,10 +700,15 @@ func TestHTLCReceiverSpendValidation(t *testing.T) {
|
||||
SigHashes: sweepTxSigHashes,
|
||||
InputIndex: 0,
|
||||
}
|
||||
aliceSenderSig, err = aliceSigner.SignOutputRaw(sweepTx, &aliceSignDesc)
|
||||
aliceSigBytes, err := aliceSigner.SignOutputRaw(sweepTx, &aliceSignDesc)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to generate alice signature: %v", err)
|
||||
}
|
||||
|
||||
aliceSenderSig, err = btcec.ParseDERSignature(aliceSigBytes, btcec.S256())
|
||||
if err != nil {
|
||||
t.Fatalf("unable to parse signature: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(roasbeef): modify valid to check precise script errors?
|
||||
|
Reference in New Issue
Block a user