[Pkg-bitcoin-commits] [bitcoin] 12/126: Add getmininginfo functional test
Jonas Smedegaard
dr at jones.dk
Mon Nov 13 20:00:27 UTC 2017
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/0.15.1_dfsg-1
in repository bitcoin.
commit 847c75ec6447f58b6c4f3732a10551f1faddbb0b
Author: Cristian Mircea Messel <mess110 at gmail.com>
Date: Sat Aug 26 01:20:33 2017 +0300
Add getmininginfo functional test
Github-Pull: #11150
Rebased-From: 4f2905b76b502a9de235dbe739e5fe504ef5bc22
---
test/functional/mining.py | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/test/functional/mining.py b/test/functional/mining.py
index dbd4e29..f3d1f3e 100755
--- a/test/functional/mining.py
+++ b/test/functional/mining.py
@@ -4,16 +4,18 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test mining RPCs
+- getmininginfo
- getblocktemplate proposal mode
- submitblock"""
-from binascii import b2a_hex
import copy
+from binascii import b2a_hex
+from decimal import Decimal
from test_framework.blocktools import create_coinbase
-from test_framework.test_framework import BitcoinTestFramework
from test_framework.mininode import CBlock
-from test_framework.util import *
+from test_framework.test_framework import BitcoinTestFramework
+from test_framework.util import assert_equal, assert_raises_jsonrpc
def b2x(b):
return b2a_hex(b).decode('ascii')
@@ -33,6 +35,18 @@ class MiningTest(BitcoinTestFramework):
def run_test(self):
node = self.nodes[0]
+
+ self.log.info('getmininginfo')
+ mining_info = node.getmininginfo()
+ assert_equal(mining_info['blocks'], 200)
+ assert_equal(mining_info['chain'], 'regtest')
+ assert_equal(mining_info['currentblocksize'], 0)
+ assert_equal(mining_info['currentblocktx'], 0)
+ assert_equal(mining_info['currentblockweight'], 0)
+ assert_equal(mining_info['difficulty'], Decimal('4.656542373906925E-10'))
+ assert_equal(mining_info['networkhashps'], Decimal('0.003333333333333334'))
+ assert_equal(mining_info['pooledtx'], 0)
+
# Mine a block to leave initial block download
node.generate(1)
tmpl = node.getblocktemplate()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bitcoin/bitcoin.git
More information about the Pkg-bitcoin-commits
mailing list