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
@@ -425,7 +425,6 @@ class MiningTest(BitcoinTestFramework):
|
||||
coinbase_tx = create_coinbase(height=next_height)
|
||||
# sequence numbers must not be max for nLockTime to have effect
|
||||
coinbase_tx.vin[0].nSequence = 2**32 - 2
|
||||
coinbase_tx.rehash()
|
||||
|
||||
block = CBlock()
|
||||
block.nVersion = tmpl["version"]
|
||||
@@ -447,7 +446,6 @@ class MiningTest(BitcoinTestFramework):
|
||||
self.log.info("getblocktemplate: Test bad input hash for coinbase transaction")
|
||||
bad_block = copy.deepcopy(block)
|
||||
bad_block.vtx[0].vin[0].prevout.hash += 1
|
||||
bad_block.vtx[0].rehash()
|
||||
assert_template(node, bad_block, 'bad-cb-missing')
|
||||
|
||||
self.log.info("submitblock: Test bad input hash for coinbase transaction")
|
||||
@@ -481,7 +479,6 @@ class MiningTest(BitcoinTestFramework):
|
||||
bad_block = copy.deepcopy(block)
|
||||
bad_tx = copy.deepcopy(bad_block.vtx[0])
|
||||
bad_tx.vin[0].prevout.hash = 255
|
||||
bad_tx.rehash()
|
||||
bad_block.vtx.append(bad_tx)
|
||||
assert_template(node, bad_block, 'bad-txns-inputs-missingorspent')
|
||||
assert_submitblock(bad_block, 'bad-txns-inputs-missingorspent')
|
||||
@@ -489,7 +486,6 @@ class MiningTest(BitcoinTestFramework):
|
||||
self.log.info("getblocktemplate: Test nonfinal transaction")
|
||||
bad_block = copy.deepcopy(block)
|
||||
bad_block.vtx[0].nLockTime = 2**32 - 1
|
||||
bad_block.vtx[0].rehash()
|
||||
assert_template(node, bad_block, 'bad-txns-nonfinal')
|
||||
assert_submitblock(bad_block, 'bad-txns-nonfinal')
|
||||
|
||||
@@ -563,7 +559,6 @@ class MiningTest(BitcoinTestFramework):
|
||||
|
||||
bad_block_lock = copy.deepcopy(block)
|
||||
bad_block_lock.vtx[0].nLockTime = 2**32 - 1
|
||||
bad_block_lock.vtx[0].rehash()
|
||||
bad_block_lock.hashMerkleRoot = bad_block_lock.calc_merkle_root()
|
||||
bad_block_lock.solve()
|
||||
assert_equal(node.submitblock(hexdata=bad_block_lock.serialize().hex()), 'bad-txns-nonfinal')
|
||||
|
||||
Reference in new issue
Block a user