Hi There,
I am trying to write the code for the above requirement within the `example_test.py` in the functional test directory,
This is the code I have written:
def run_test(self):
"""Main test logic"""
# Create P2P connections will wait for a verack to make sure the connection is fully up
peer_messaging = self.nodes[0].add_p2p_connection(BaseNode())
# Generating a block on one of the nodes will get us out of IBD
blocks = [int(self.nodes[0].generate(nblocks=1)[0], 16)]
self.sync_all(self.nodes[0:2])
self.log.info("Starting test!")
# Getting node 1 to mine another block,
self.log.info("Getting node 1 to generate a block")
self.nodes[1].generate(1)
# Send the generated block to node 2
self.log.info("Sending the generated block from node 1 to node 2")
self.sync_blocks()
# Check that node 2 received it.
self.log.info("Testing if node 2 has received the block from node 1")
assert_equal(self.nodes[1].getbestblockhash(), self.nodes[2].getbestblockhash())
self.log.info("Ending Test")
Now, How can I test if it is actually happening [Getting node 1 to mine a block, send it to node 2,and check node2 received it.] or if I am just imagining all these things?
Thanks again
Noob.