Rebased/nits fixed version of #13250.
Setting the send flag to false can be replaced by simply returning.
Concept ACK
5 | +"""Request non-existent block. 6 | +""" 7 | + 8 | +from test_framework.mininode import * 9 | +from test_framework.test_framework import BitcoinTestFramework 10 | +from test_framework.util import *
Remove, it's unnecessary.
0 | @@ -0,0 +1,32 @@ 1 | +#!/usr/bin/env python3 2 | +# Copyright (c) 2018 The Bitcoin Core developers 3 | +# Distributed under the MIT software license, see the accompanying 4 | +# file COPYING or http://www.opensource.org/licenses/mit-license.php. 5 | +"""Request non-existent block. 6 | +""" 7 | + 8 | +from test_framework.mininode import *
Specify:
from test_framework.mininode import (CInv, P2PInterface, msg_getdata)
Concept ACK, simplification is correct. Not sure about the new test.
utACK 4677dc25d4fa3183e745d2b2f995809845148cc8. Didn't review the test.
I think it is somewhat subjective whether an early return is preferable to a status variable.
ACK on the test in any case.
9 | +from test_framework.test_framework import BitcoinTestFramework 10 | + 11 | +# TestP2PConn: A peer we use to send messages to bitcoind, and store responses. 12 | +class TestP2PConn(P2PInterface): 13 | + def __init__(self): 14 | + super().__init__()
Doesn't seem like this subclass is necessary. Any reason you can't just use P2PInterface on line 23 below?
Agree. (Sorry, my previous comment didn't apply, thus deleted)
<!--e57a25ab6845829454e8d69fc972939a-->No more conflicts as of last run.
17 | + # Setup the p2p connections and start up the network thread. 18 | + self.test_node = self.nodes[0].add_p2p_connection(P2PInterface()) 19 | + 20 | + self.test_node.wait_for_verack() 21 | + 22 | + self.test_node.send_message(msg_getdata(inv=[CInv(2, 0)]))
What is this testing? I don't see any assertions.
I think an earlier version of the code would crash when receiving such an inv. But yeah, somewhat agree that a new test file with all the overhead is a bit too much for testing so little
Concept ACK
Setting the send flag to false can be replaced by simply returning.
I've just dropped the test entirely here.
utACK 0cf546f71ebbee960fdca044e7abd100eec7b688 ...
... as long as these horrible single line if statements with multiple nested parens are cleaned up soon after
Reviee