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:
1 parent
a2724e3ea3
commit
9b3dce24a3
26 files changed
-158
No files matched your search
@@ -40,7 +40,6 @@ def signet_txs(block, challenge):
|
||||
txs[0].vout[-1].scriptPubKey += CScriptOp.encode_op_pushdata(SIGNET_HEADER)
|
||||
hashes = []
|
||||
for tx in txs:
|
||||
tx.rehash()
|
||||
hashes.append(ser_uint256(tx.sha256))
|
||||
mroot = block.get_merkle_root(hashes)
|
||||
|
||||
@@ -55,7 +54,6 @@ def signet_txs(block, challenge):
|
||||
to_spend.nLockTime = 0
|
||||
to_spend.vin = [CTxIn(COutPoint(0, 0xFFFFFFFF), b"\x00" + CScriptOp.encode_op_pushdata(sd), 0)]
|
||||
to_spend.vout = [CTxOut(0, challenge)]
|
||||
to_spend.rehash()
|
||||
|
||||
spend = CTransaction()
|
||||
spend.version = 0
|
||||
@@ -88,7 +86,6 @@ def finish_block(block, signet_solution, grind_cmd):
|
||||
pass # Don't need to add a signet commitment if there's no signet signature needed
|
||||
else:
|
||||
block.vtx[0].vout[-1].scriptPubKey += CScriptOp.encode_op_pushdata(SIGNET_HEADER + signet_solution)
|
||||
block.vtx[0].rehash()
|
||||
block.hashMerkleRoot = block.calc_merkle_root()
|
||||
if grind_cmd is None:
|
||||
block.solve()
|
||||
@@ -111,7 +108,6 @@ def new_block(tmpl, reward_spk, *, blocktime=None, poolid=None):
|
||||
cbtx.vin = [CTxIn(COutPoint(0, 0xffffffff), scriptSig, MAX_SEQUENCE_NONFINAL)]
|
||||
cbtx.vout = [CTxOut(tmpl["coinbasevalue"], reward_spk)]
|
||||
cbtx.vin[0].nSequence = 2**32-2
|
||||
cbtx.rehash()
|
||||
|
||||
block = CBlock()
|
||||
block.nVersion = tmpl["version"]
|
||||
@@ -130,7 +126,6 @@ def new_block(tmpl, reward_spk, *, blocktime=None, poolid=None):
|
||||
block.vtx[0].wit.vtxinwit = [cbwit]
|
||||
block.vtx[0].vout.append(CTxOut(0, bytes(get_witness_script(witroot, witnonce))))
|
||||
|
||||
block.vtx[0].rehash()
|
||||
block.hashMerkleRoot = block.calc_merkle_root()
|
||||
|
||||
return block
|
||||
|
||||
Reference in new issue
Block a user