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:
parent
a5a7340290
commit
bc75d044a1
|
@ -3,10 +3,10 @@ from pyblake2 import blake2b
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
from transaction import (
|
from transaction import (
|
||||||
|
LegacyTransaction,
|
||||||
MAX_MONEY,
|
MAX_MONEY,
|
||||||
OVERWINTER_TX_VERSION,
|
OVERWINTER_TX_VERSION,
|
||||||
Script,
|
Script,
|
||||||
Transaction,
|
|
||||||
)
|
)
|
||||||
from tv_output import render_args, render_tv, Some
|
from tv_output import render_args, render_tv, Some
|
||||||
from tv_rand import Rand
|
from tv_rand import Rand
|
||||||
|
@ -111,7 +111,7 @@ def main():
|
||||||
|
|
||||||
test_vectors = []
|
test_vectors = []
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
tx = Transaction(rand, OVERWINTER_TX_VERSION)
|
tx = LegacyTransaction(rand, OVERWINTER_TX_VERSION)
|
||||||
scriptCode = Script(rand)
|
scriptCode = Script(rand)
|
||||||
nIn = rand.i8() % (len(tx.vin) + 1)
|
nIn = rand.i8() % (len(tx.vin) + 1)
|
||||||
if nIn == len(tx.vin):
|
if nIn == len(tx.vin):
|
||||||
|
|
|
@ -3,10 +3,10 @@ from pyblake2 import blake2b
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
from transaction import (
|
from transaction import (
|
||||||
|
LegacyTransaction,
|
||||||
MAX_MONEY,
|
MAX_MONEY,
|
||||||
SAPLING_TX_VERSION,
|
SAPLING_TX_VERSION,
|
||||||
Script,
|
Script,
|
||||||
Transaction,
|
|
||||||
)
|
)
|
||||||
from tv_output import render_args, render_tv, Some
|
from tv_output import render_args, render_tv, Some
|
||||||
from tv_rand import Rand
|
from tv_rand import Rand
|
||||||
|
@ -118,7 +118,7 @@ def main():
|
||||||
|
|
||||||
test_vectors = []
|
test_vectors = []
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
tx = Transaction(rand, SAPLING_TX_VERSION)
|
tx = LegacyTransaction(rand, SAPLING_TX_VERSION)
|
||||||
scriptCode = Script(rand)
|
scriptCode = Script(rand)
|
||||||
nIn = rand.i8() % (len(tx.vin) + 1)
|
nIn = rand.i8() % (len(tx.vin) + 1)
|
||||||
if nIn == len(tx.vin):
|
if nIn == len(tx.vin):
|
||||||
|
|
|
@ -6,7 +6,7 @@ from transaction import (
|
||||||
MAX_MONEY,
|
MAX_MONEY,
|
||||||
NU5_TX_VERSION,
|
NU5_TX_VERSION,
|
||||||
Script,
|
Script,
|
||||||
Transaction,
|
TransactionV5,
|
||||||
)
|
)
|
||||||
from tv_output import render_args, render_tv, Some
|
from tv_output import render_args, render_tv, Some
|
||||||
from tv_rand import Rand
|
from tv_rand import Rand
|
||||||
|
@ -266,7 +266,7 @@ def main():
|
||||||
|
|
||||||
test_vectors = []
|
test_vectors = []
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
tx = Transaction(rand, NU5_TX_VERSION, consensusBranchId)
|
tx = TransactionV5(rand, consensusBranchId)
|
||||||
txid = txid_digest(tx)
|
txid = txid_digest(tx)
|
||||||
|
|
||||||
# If there are any transparent inputs, derive a corresponding transparent sighash.
|
# If there are any transparent inputs, derive a corresponding transparent sighash.
|
||||||
|
|
Loading…
Reference in New Issue