MCPcopy Create free account
hub / github.com/ElementsProject/elements / run_test

Method run_test

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected