input: add weight estimation + tests for all taproot witness gen types

This commit is contained in:
Olaoluwa Osuntokun committed 2023-08-22 16:32:44 -07:00
1 parent d3c7c51f7e
commit 405a435a84
5 files changed
+956 -64

No files matched your search

+7 -3
View File
@@ -224,6 +224,8 @@ func TestTaprootSenderHtlcSpend(t *testing.T) {
testCases := []struct {
name string
// TODO(roasbeef): use sighash slice
witnessGen witnessGen
txInMutator func(txIn *wire.TxIn)
@@ -437,7 +439,7 @@ type testReceiverHtlcScriptTree struct {
receiverKey *btcec.PrivateKey
revokeKey *btcec.PrivateKey
revokeKey btcec.PrivateKey
htlcTxOut *wire.TxOut
@@ -486,7 +488,7 @@ func newTestReceiverHtlcScriptTree(t *testing.T) *testReceiverHtlcScriptTree {
preImage: preImage,
senderKey: senderKey,
receiverKey: receiverKey,
revokeKey: revokeKey,
revokeKey: *revokeKey,
htlcTxOut: targetTxOut,
htlcAmt: htlcAmt,
rootHash: htlcScriptTree.TapscriptRoot,
@@ -542,7 +544,7 @@ func htlcReceiverRevocationWitnessGen(sigHash txscript.SigHashType,
revokeKey := htlcScriptTree.revokeKey
signer := &MockSigner{
Privkeys: []*btcec.PrivateKey{
revokeKey,
&revokeKey,
},
}
@@ -637,6 +639,8 @@ func TestTaprootReceiverHtlcSpend(t *testing.T) {
// signing below.
htlcScriptTree := newTestReceiverHtlcScriptTree(t)
// TODO(roasbeef): issue with revoke key??? ctrl block even/odd
spendTx := wire.NewMsgTx(2)
spendTx.AddTxIn(&wire.TxIn{})
spendTx.AddTxOut(&wire.TxOut{