| 14 | from test_framework.util import assert_equal, disconnect_nodes, connect_nodes_bi, sync_blocks, wait_until |
| 15 | |
| 16 | class P2PIgnoreInv(P2PInterface): |
| 17 | firstAddrnServices = 0 |
| 18 | def on_inv(self, message): |
| 19 | # The node will send us invs for other blocks. Ignore them. |
| 20 | pass |
| 21 | def on_addr(self, message): |
| 22 | self.firstAddrnServices = message.addrs[0].nServices |
| 23 | def wait_for_addr(self, timeout=5): |
| 24 | test_function = lambda: self.last_message.get("addr") |
| 25 | wait_until(test_function, timeout=timeout, lock=mininode_lock) |
| 26 | def send_getdata_for_block(self, blockhash): |
| 27 | getdata_request = msg_getdata() |
| 28 | getdata_request.inv.append(CInv(2, int(blockhash, 16))) |
| 29 | self.send_message(getdata_request) |
| 30 | |
| 31 | class NodeNetworkLimitedTest(BitcoinTestFramework): |
| 32 | def set_test_params(self): |