diff --git a/pyhmy/rpc/blockchain.py b/pyhmy/rpc/blockchain.py index 837e492..c28bccd 100644 --- a/pyhmy/rpc/blockchain.py +++ b/pyhmy/rpc/blockchain.py @@ -501,3 +501,22 @@ def get_validators(epoch, endpoint=_default_endpoint, timeout=_default_timeout) epoch ] 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'] diff --git a/tests/rpc-pyhmy/test_blockchain.py b/tests/rpc-pyhmy/test_blockchain.py index 9a4b638..7b10c4a 100644 --- a/tests/rpc-pyhmy/test_blockchain.py +++ b/tests/rpc-pyhmy/test_blockchain.py @@ -109,3 +109,9 @@ def test_get_staking_epoch(setup_blockchain): @pytest.mark.run(order=19) def test_get_prestaking_epoch(setup_blockchain): _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)