Skip to content

Commit c91ba8a

Browse files
committed
fix: no crashes allowed
1 parent a4cd1d6 commit c91ba8a

File tree

1 file changed

+8
-25
lines changed

1 file changed

+8
-25
lines changed

test/functional/feature_dip0020_activation.py

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,9 @@ def run_test(self):
7575

7676
self.log.info("Transactions spending coins with new opcodes aren't accepted before DIP0020 activation")
7777
assert not softfork_active(node, 'dip0020')
78-
try:
79-
assert_raises_rpc_error(-26, DISABLED_OPCODE_ERROR, node.sendrawtransaction, tx0_hex)
80-
except:
81-
self.start_node(0)
82-
try:
83-
helper_peer = node.add_p2p_connection(P2PDataStore())
84-
helper_peer.send_txs_and_test([tx0], node, success=False, reject_reason=DISABLED_OPCODE_ERROR)
85-
except:
86-
self.start_node(0)
87-
helper_peer = node.add_p2p_connection(P2PDataStore())
78+
assert_raises_rpc_error(-26, DISABLED_OPCODE_ERROR, node.sendrawtransaction, tx0_hex)
79+
helper_peer = node.add_p2p_connection(P2PDataStore())
80+
helper_peer.send_txs_and_test([tx0], node, success=False, reject_reason=DISABLED_OPCODE_ERROR)
8881
tip = node.getblock(node.getbestblockhash(), 1)
8982
test_block = self.create_test_block([tx0], tip["hash"], tip["height"], tip["time"])
9083
helper_peer.send_blocks_and_test([test_block], node, success=False, reject_reason='block-validation-failed', expect_disconnect=True)
@@ -100,25 +93,15 @@ def run_test(self):
10093

10194
# Still need 1 more block for mempool to accept txes spending new opcodes
10295
self.log.info("Transactions spending coins with new opcodes aren't accepted at DIP0020 activation block")
103-
try:
104-
assert_raises_rpc_error(-26, DISABLED_OPCODE_ERROR, node.sendrawtransaction, tx0_hex)
105-
except:
106-
self.start_node(0)
107-
try:
108-
helper_peer = node.add_p2p_connection(P2PDataStore())
109-
helper_peer.send_txs_and_test([tx0], node, success=False, reject_reason=DISABLED_OPCODE_ERROR)
110-
except:
111-
self.start_node(0)
112-
helper_peer = node.add_p2p_connection(P2PDataStore())
96+
assert_raises_rpc_error(-26, DISABLED_OPCODE_ERROR, node.sendrawtransaction, tx0_hex)
97+
helper_peer = node.add_p2p_connection(P2PDataStore())
98+
helper_peer.send_txs_and_test([tx0], node, success=False, reject_reason=DISABLED_OPCODE_ERROR)
11399
# A block containing new opcodes is accepted however
114100
tip = node.getblock(node.getbestblockhash(), 1)
115101
test_block = self.create_test_block([tx0], tip["hash"], tip["height"], tip["time"])
116102
helper_peer.send_blocks_and_test([test_block], node, success=True)
117-
try:
118-
# txes spending new opcodes still won't be accepted into mempool if we roll back to the previous tip
119-
node.invalidateblock(node.getbestblockhash())
120-
except:
121-
self.start_node(0)
103+
# txes spending new opcodes still won't be accepted into mempool if we roll back to the previous tip
104+
node.invalidateblock(node.getbestblockhash())
122105
assert tx0id not in set(node.getrawmempool())
123106
node.generate(1)
124107

0 commit comments

Comments
 (0)