diff options
author | Jimmy Song <jaejoon@gmail.com> | 2017-04-20 11:43:58 -0700 |
---|---|---|
committer | Jimmy Song <jaejoon@gmail.com> | 2017-04-21 09:58:29 -0700 |
commit | de487b730b4ecbaf91995d6d6c55cff2fd985250 (patch) | |
tree | e011d101796e815b53768eda1e5e70d8574a2977 /test/functional | |
parent | a6548a47a5548b4b43510c548a9418673ab751de (diff) | |
download | bitcoin-de487b730b4ecbaf91995d6d6c55cff2fd985250.tar.xz |
Tests: Add test for getnetworkhashps
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/blockchain.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/functional/blockchain.py b/test/functional/blockchain.py index de5e01c2e3..2c20f5390a 100755 --- a/test/functional/blockchain.py +++ b/test/functional/blockchain.py @@ -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() |