MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / run_test

Method run_test

test/functional/p2p_getdata.py:29–44  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

27 self.num_nodes = 1
28
29 def run_test(self):
30 p2p_block_store = self.nodes[0].add_p2p_connection(P2PStoreBlock())
31
32 self.log.info("test that an invalid GETDATA doesn't prevent processing of future messages")
33
34 # Send invalid message and verify that node responds to later ping
35 invalid_getdata = msg_getdata()
36 invalid_getdata.inv.append(CInv(t=0, h=0)) # INV type 0 is invalid.
37 p2p_block_store.send_and_ping(invalid_getdata)
38
39 # Check getdata still works by fetching tip block
40 best_block = int(self.nodes[0].getbestblockhash(), 16)
41 good_getdata = msg_getdata()
42 good_getdata.inv.append(CInv(t=2, h=best_block))
43 p2p_block_store.send_and_ping(good_getdata)
44 p2p_block_store.wait_until(lambda: p2p_block_store.blocks[best_block] == 1)
45
46
47if __name__ == '__main__':

Callers

nothing calls this directly

Calls 7

msg_getdataClass · 0.90
CInvClass · 0.90
P2PStoreBlockClass · 0.85
add_p2p_connectionMethod · 0.80
infoMethod · 0.80
send_and_pingMethod · 0.80
wait_untilMethod · 0.45

Tested by

no test coverage detected