Use specific tx formats compatible with sighash algorithms

ZIP 244 is only defined for v5 transactions, so use the TransactionV5
type directly; likewise use LegacyTransaction with the ZIP 143 and
ZIP 243 APIs.
This commit is contained in:
Jack Grigg 2021-05-26 18:01:00 +01:00
parent a5a7340290
commit bc75d044a1
3 changed files with 6 additions and 6 deletions

View File

@ -3,10 +3,10 @@ from pyblake2 import blake2b
import struct
from transaction import (
LegacyTransaction,
MAX_MONEY,
OVERWINTER_TX_VERSION,
Script,
Transaction,
)
from tv_output import render_args, render_tv, Some
from tv_rand import Rand
@ -111,7 +111,7 @@ def main():
test_vectors = []
for i in range(10):
tx = Transaction(rand, OVERWINTER_TX_VERSION)
tx = LegacyTransaction(rand, OVERWINTER_TX_VERSION)
scriptCode = Script(rand)
nIn = rand.i8() % (len(tx.vin) + 1)
if nIn == len(tx.vin):

View File

@ -3,10 +3,10 @@ from pyblake2 import blake2b
import struct
from transaction import (
LegacyTransaction,
MAX_MONEY,
SAPLING_TX_VERSION,
Script,
Transaction,
)
from tv_output import render_args, render_tv, Some
from tv_rand import Rand
@ -118,7 +118,7 @@ def main():
test_vectors = []
for _ in range(10):
tx = Transaction(rand, SAPLING_TX_VERSION)
tx = LegacyTransaction(rand, SAPLING_TX_VERSION)
scriptCode = Script(rand)
nIn = rand.i8() % (len(tx.vin) + 1)
if nIn == len(tx.vin):

View File

@ -6,7 +6,7 @@ from transaction import (
MAX_MONEY,
NU5_TX_VERSION,
Script,
Transaction,
TransactionV5,
)
from tv_output import render_args, render_tv, Some
from tv_rand import Rand
@ -266,7 +266,7 @@ def main():
test_vectors = []
for _ in range(10):
tx = Transaction(rand, NU5_TX_VERSION, consensusBranchId)
tx = TransactionV5(rand, consensusBranchId)
txid = txid_digest(tx)
# If there are any transparent inputs, derive a corresponding transparent sighash.