mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 05:32:22 +02:00
test: prep manual equality assert conversions
The later scripted diff only handles plain `assert x == y` lines. Some remaining tests still use equality inside comprehensions, parenthesized asserts, and other shapes that the line-based rewrite would misread. Rewrite those sites by hand first so the later mechanical conversion stays safe. The commit also simplifies the dead `len(["errors"]) == 0` branch in `blocktools.py`, which can never be true.
This commit is contained in:
@@ -21,6 +21,7 @@ from .messages import (
|
||||
)
|
||||
|
||||
from .crypto.ripemd160 import ripemd160
|
||||
from .util import assert_equal
|
||||
|
||||
MAX_SCRIPT_ELEMENT_SIZE = 520
|
||||
MAX_SCRIPT_SIZE = 10000
|
||||
@@ -814,8 +815,8 @@ def BIP341_sha_outputs(txTo):
|
||||
return sha256(b"".join(o.serialize() for o in txTo.vout))
|
||||
|
||||
def TaprootSignatureMsg(txTo, spent_utxos, hash_type, input_index=0, *, scriptpath=False, leaf_script=None, codeseparator_pos=-1, annex=None, leaf_ver=LEAF_VERSION_TAPSCRIPT):
|
||||
assert (len(txTo.vin) == len(spent_utxos))
|
||||
assert (input_index < len(txTo.vin))
|
||||
assert_equal(len(txTo.vin), len(spent_utxos))
|
||||
assert input_index < len(txTo.vin)
|
||||
out_type = SIGHASH_ALL if hash_type == 0 else hash_type & 3
|
||||
in_type = hash_type & SIGHASH_ANYONECANPAY
|
||||
spk = spent_utxos[input_index].scriptPubKey
|
||||
|
||||
Reference in New Issue
Block a user