This whole sub-test can be removed (everything from # restart node with sending BIP61 messages disabled, check that it disconnects without sending the reject message
onward)
You could also update L71 higher up to test the reject reason:
0+++ b/test/functional/p2p_invalid_tx.py
1@@ -68,7 +68,8 @@ class InvalidTxRequestTest(BitcoinTestFramework):
2 # and we get disconnected immediately
3 self.log.info('Test a transaction that is rejected')
4 tx1 = create_tx_with_script(block1.vtx[0], 0, script_sig=b'\x64' * 35, amount=50 * COIN - 12000)
5- node.p2p.send_txs_and_test([tx1], node, success=False, expect_disconnect=True)
6+ node.p2p.send_txs_and_test([tx1], node, success=False, expect_disconnect=True,
7+ reject_reason="{} from peer=0 was not accepted: mandatory-script-verify-flag-failed (Invalid OP_IF construction) (code 16)".format(tx1.hash))