Builds on #11771. Please review that PR first
Next step in #10603.
- first commit tidies up invalidblockrequest.py
- second commit removes usage of ComparisonTestFramework
79- self.block_time += 1
80- test.blocks_and_transactions.append([block, True])
81- height += 1
82- yield test
83+ best_block = node.getblock(node.getbestblockhash())
84+ tip = int("0x" + node.getbestblockhash(), 0)
In commit “Change invalidblockrequest to use BitcoinTestFramework”
Maybe avoid 0x prefix here and above by calling int(hash, 16)
Reviewed last two commits only. Other commits are part of #11771 (and out of date).
This requires rebase now that #11771 has been merged.
Review comments from @conscott to address in this PR:
block_time
variable can be removed (https://github.com/bitcoin/bitcoin/pull/11771#discussion_r167710791)height
variable can be removed (https://github.com/bitcoin/bitcoin/pull/11771#pullrequestreview-95970049)send_txs_and_test()
is never called with sucess=True
. Either remove that variable or add a successful call to send_txs_and_test()
to exercise code path (https://github.com/bitcoin/bitcoin/pull/11771#pullrequestreview-95979452)
Remove unused variable reassignments in p2p_invalid_tx.py and call
send_txs_and_test() with valid transaction.
[tests] update tests from changes to mininode in #11771 - added by @conscott
[tests] trivial update to hex conversion for readability - added by @conscott
Not an issue with your code, but eq() is not implemented for CTransaction, so the argument to assert is always true, since none of the tx objects are the same reference (they were copied).
Agree - this assert: https://github.com/bitcoin/bitcoin/blob/00d1680498c5550e7db1f359202d3433a092fafd/test/functional/p2p_invalid_block.py#L83 should be removed in a future PR.
jnewbery
ryanofsky
jamesob
MarcoFalke
Labels
Tests