Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
canonbrother committed Aug 24, 2023
1 parent b892969 commit 78a4b9a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/functional/rpc_blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def run_test(self):
) # Set extra args with pruning after rescan is complete

self._test_getblockchaininfo()
self._test_getgenesisblock()
self._test_getchaintxstats()
self._test_gettxoutsetinfo()
self._test_getblockheader()
Expand Down Expand Up @@ -401,6 +402,29 @@ def _test_getblockheader(self):
assert isinstance(int(header["versionHex"], 16), int)
assert isinstance(header["difficulty"], Decimal)

def _test_getgenesisblock(self):
node = self.nodes[0]
genesis = node.getblock(node.getblockhash(0))
assert genesis["hash"]
assert_equal(genesis["confirmations"], 201)
assert_equal(genesis["strippedsize"], 1288)
assert_equal(genesis["weight"], 5152)
assert_equal(genesis["height"], 0)
assert genesis["masternode"]
assert_equal(genesis["mintedBlocks"], 0)
assert_equal(genesis["stakeModifier"], "0000000000000000000000000000000000000000000000000000000000000000")
assert_equal(genesis["version"], 1)
assert_equal(genesis["versionHex"], "00000001")
assert genesis["merkleroot"]
assert genesis["tx"]
assert genesis["time"]
assert genesis["mediantime"]
assert genesis["bits"]
assert genesis["difficulty"]
assert genesis["chainwork"]
assert genesis["nTx"]
assert genesis["nextblockhash"]

def _test_getdifficulty(self):
difficulty = self.nodes[0].getdifficulty()
# 1 hash in 2 should be valid, so difficulty should be 1/2**31
Expand Down

0 comments on commit 78a4b9a

Please sign in to comment.