Skip to content

Instantly share code, notes, and snippets.

@johnny9
Created December 10, 2022 19:18
Show Gist options
  • Select an option

  • Save johnny9/7041e7f2c9e413165c1f295271e90839 to your computer and use it in GitHub Desktop.

Select an option

Save johnny9/7041e7f2c9e413165c1f295271e90839 to your computer and use it in GitHub Desktop.
Node 1 mines and sends to node 2
diff --git a/test/functional/example_test.py b/test/functional/example_test.py
index 3ea761466..93f5c01d7 100755
--- a/test/functional/example_test.py
+++ b/test/functional/example_test.py
@@ -223,6 +223,25 @@ class ExampleTest(BitcoinTestFramework):
for block in peer_receiving.block_receive_map.values():
assert_equal(block, 1)
+ self.disconnect_nodes(1,2)
+
+ current_height = self.nodes[1].getblockcount()
+ expected_height = current_height + 1
+
+ # Have node 1 mine a new block
+ block_hash = self.generate(self.nodes[1], 1, sync_fun=self.no_op)[0]
+ assert_equal(self.nodes[1].getblockcount(), expected_height)
+ assert_equal(self.nodes[1].getblockhash(expected_height), block_hash)
+ assert_equal(self.nodes[2].getblockcount(), current_height)
+
+ # Reconnect nodes 1 and 2
+ self.connect_nodes(1,2)
+ self.sync_all()
+
+ # Check the block hash matches on node 2
+ assert_equal(self.nodes[2].getblockcount(), expected_height)
+ assert_equal(self.nodes[2].getblockhash(expected_height), block_hash)
+
if __name__ == '__main__':
ExampleTest().main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment