Skip to content

Instantly share code, notes, and snippets.

@rserranon
Last active October 1, 2022 20:37
Show Gist options
  • Save rserranon/b8118a9d74c0b96335977c5037333afb to your computer and use it in GitHub Desktop.
Save rserranon/b8118a9d74c0b96335977c5037333afb to your computer and use it in GitHub Desktop.
Exercise 3 Chain Code
#
# Chaincode excercise 3
#
# generate new block
self.log.info("Generate new block")
new_block_hash = self.generate(self.nodes[1], 1)
# sync previously connected nodes
self.log.info("Sync previously connected nodes")
self.sync_all()
# find block and get hash
self.log.info("Find block and get hash")
hash = self.nodes[2].getblock(new_block_hash[0], 1)['hash']
# assert both hashes are equal
self.log.info("Asserting we find the right block")
assert_equal(new_block_hash[0], hash)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment