mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Tests: Add test for getnetworkhashps
This commit is contained in:
parent
a6548a47a5
commit
de487b730b
@ -10,6 +10,7 @@ Test the following RPCs:
|
||||
- getbestblockhash
|
||||
- getblockhash
|
||||
- getblockheader
|
||||
- getnetworkhashps
|
||||
- verifychain
|
||||
|
||||
Tests correspond to code in rpc/blockchain.cpp.
|
||||
@ -45,6 +46,7 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
self._test_gettxoutsetinfo()
|
||||
self._test_getblockheader()
|
||||
self._test_getdifficulty()
|
||||
self._test_getnetworkhashps()
|
||||
self.nodes[0].verifychain(4, 0)
|
||||
|
||||
def _test_gettxoutsetinfo(self):
|
||||
@ -91,5 +93,10 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
# binary => decimal => binary math is why we do this check
|
||||
assert abs(difficulty * 2**31 - 1) < 0.0001
|
||||
|
||||
def _test_getnetworkhashps(self):
|
||||
hashes_per_second = self.nodes[0].getnetworkhashps()
|
||||
# This should be 2 hashes every 10 minutes or 1/300
|
||||
assert abs(hashes_per_second * 300 - 1) < 0.0001
|
||||
|
||||
if __name__ == '__main__':
|
||||
BlockchainTest().main()
|
||||
|
Loading…
Reference in New Issue
Block a user