[blockchain] Add method for hmy_getCurrentBadBlocks

[test] Add test for new method
pull/3/head
Janet Liang 5 years ago
parent 021fe948e7
commit d5fbdd9575
  1. 19
      pyhmy/rpc/blockchain.py
  2. 6
      tests/rpc-pyhmy/test_blockchain.py

@ -501,3 +501,22 @@ def get_validators(epoch, endpoint=_default_endpoint, timeout=_default_timeout)
epoch epoch
] ]
return rpc_request('hmy_getValidators', params=params, endpoint=endpoint, timeout=timeout)['result'] return rpc_request('hmy_getValidators', params=params, endpoint=endpoint, timeout=timeout)['result']
def get_bad_blocks(endpoint=_default_endpoint, timeout=_default_timeout) -> dict:
"""
Get list of bad blocks in memory of specific node
Parameters
----------
endpoint: :obj:`str`, optional
Endpoint to send request to
timeout: :obj:`int`, optional
Timeout in seconds
Returns
-------
list
# TODO: Add link to reference RPC documentation
"""
return rpc_request('hmy_getCurrentBadBlocks', endpoint=endpoint, timeout=timeout)['result']

@ -109,3 +109,9 @@ def test_get_staking_epoch(setup_blockchain):
@pytest.mark.run(order=19) @pytest.mark.run(order=19)
def test_get_prestaking_epoch(setup_blockchain): def test_get_prestaking_epoch(setup_blockchain):
_test_blockchain_rpc(blockchain.get_prestaking_epoch) _test_blockchain_rpc(blockchain.get_prestaking_epoch)
@pytest.mark.run(order=20)
def test_get_bad_blocks(setup_blockchain):
# TODO: Remove skip when RPC is fixed
pytest.skip("Known error with hmy_getCurrentBadBlocks")
_test_blockchain_rpc(blockchain.get_bad_blocks)

Loading…
Cancel
Save