MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / _test_getblockheader

Method _test_getblockheader

test/functional/rpc_blockchain.py:206–231  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

204 assert_equal(res, res3)
205
206 def _test_getblockheader(self):
207 node = self.nodes[0]
208
209 assert_raises_rpc_error(-5, "Block not found", node.getblockheader, "nonsense")
210
211 besthash = node.getbestblockhash()
212 secondbesthash = node.getblockhash(199)
213 header = node.getblockheader(besthash)
214
215 assert_equal(header['hash'], besthash)
216 assert_equal(header['height'], 200)
217 assert_equal(header['confirmations'], 1)
218 assert_equal(header['previousblockhash'], secondbesthash)
219 assert_is_hex_string(header['chainwork'])
220 assert_equal(header['nTx'], 1)
221 assert_is_hash_string(header['hash'])
222 assert_is_hash_string(header['previousblockhash'])
223 assert_is_hash_string(header['merkleroot'])
224 assert_is_hash_string(header['bits'], length=None)
225 assert isinstance(header['time'], int)
226 assert isinstance(header['mediantime'], int)
227 assert_is_hash_string(header['nonce'])
228 assert isinstance(header['nonceUint32'], int)
229 assert isinstance(header['version'], int)
230 assert isinstance(int(header['versionHex'], 16), int)
231 assert isinstance(header['difficulty'], Decimal)
232
233 def _test_getdifficulty(self):
234 difficulty = self.nodes[0].getdifficulty()

Callers 1

run_testMethod · 0.95

Calls 4

assert_raises_rpc_errorFunction · 0.90
assert_equalFunction · 0.90
assert_is_hex_stringFunction · 0.90
assert_is_hash_stringFunction · 0.90

Tested by

no test coverage detected