mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
Merge #11150: [tests] Add getmininginfo test
4f2905b76
Add getmininginfo functional test (Cristian Mircea Messel)
Pull request description:
Add `getmininginfo` functional test in `mining.py`
Tree-SHA512: 12be9cfb37e9ac4c6625fc06051704c8a8dfd7271c2654f994c7659c8810e4b7a4335105ae159315308bcd45b65589bab1829bd134d2f4cabf74d63f2e5d22fe
This commit is contained in:
parent
74325db11a
commit
37250c02e2
@ -4,16 +4,18 @@
|
|||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
"""Test mining RPCs
|
"""Test mining RPCs
|
||||||
|
|
||||||
|
- getmininginfo
|
||||||
- getblocktemplate proposal mode
|
- getblocktemplate proposal mode
|
||||||
- submitblock"""
|
- submitblock"""
|
||||||
|
|
||||||
from binascii import b2a_hex
|
|
||||||
import copy
|
import copy
|
||||||
|
from binascii import b2a_hex
|
||||||
|
from decimal import Decimal
|
||||||
|
|
||||||
from test_framework.blocktools import create_coinbase
|
from test_framework.blocktools import create_coinbase
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
|
||||||
from test_framework.mininode import CBlock
|
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):
|
def b2x(b):
|
||||||
return b2a_hex(b).decode('ascii')
|
return b2a_hex(b).decode('ascii')
|
||||||
@ -33,6 +35,18 @@ class MiningTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
node = self.nodes[0]
|
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
|
# Mine a block to leave initial block download
|
||||||
node.generate(1)
|
node.generate(1)
|
||||||
tmpl = node.getblocktemplate()
|
tmpl = node.getblocktemplate()
|
||||||
|
Loading…
Reference in New Issue
Block a user