mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-23 12:14:30 +01:00
test: remove bare CTransaction .rehash()/.calc_sha256() calls
Since the previous commit, CTransaction object calls to the methods `.rehash()` and `.calc_sha256()` are effectively no-ops if the returned value is not used, so we can just remove them.
This commit is contained in:
@@ -694,7 +694,6 @@ def sign_input_legacy(tx, input_index, input_scriptpubkey, privkey, sighash_type
|
||||
assert err is None
|
||||
der_sig = privkey.sign_ecdsa(sighash)
|
||||
tx.vin[input_index].scriptSig = bytes(CScript([der_sig + bytes([sighash_type])])) + tx.vin[input_index].scriptSig
|
||||
tx.rehash()
|
||||
|
||||
def sign_input_segwitv0(tx, input_index, input_scriptpubkey, input_amount, privkey, sighash_type=SIGHASH_ALL):
|
||||
"""Add segwitv0 ECDSA signature for a given transaction input. Note that the signature
|
||||
@@ -703,7 +702,6 @@ def sign_input_segwitv0(tx, input_index, input_scriptpubkey, input_amount, privk
|
||||
sighash = SegwitV0SignatureHash(input_scriptpubkey, tx, input_index, sighash_type, input_amount)
|
||||
der_sig = privkey.sign_ecdsa(sighash)
|
||||
tx.wit.vtxinwit[input_index].scriptWitness.stack.insert(0, der_sig + bytes([sighash_type]))
|
||||
tx.rehash()
|
||||
|
||||
# TODO: Allow cached hashPrevouts/hashSequence/hashOutputs to be provided.
|
||||
# Performance optimization probably not necessary for python tests, however.
|
||||
|
||||
Reference in New Issue
Block a user