mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 18:09:47 +01:00
test: use MiniWallet for mining_basic.py
This test can now be run even with the Bitcoin Core wallet disabled.
This commit is contained in:
parent
53b0450ede
commit
7746606cfa
@ -29,6 +29,8 @@ from test_framework.util import (
|
||||
assert_equal,
|
||||
assert_raises_rpc_error,
|
||||
)
|
||||
from test_framework.wallet import MiniWallet
|
||||
|
||||
|
||||
VERSIONBITS_TOP_BITS = 0x20000000
|
||||
VERSIONBITS_DEPLOYMENT_TESTDUMMY_BIT = 28
|
||||
@ -51,14 +53,11 @@ class MiningTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.supports_cli = False
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def mine_chain(self):
|
||||
self.log.info('Create some old blocks')
|
||||
for t in range(TIME_GENESIS_BLOCK, TIME_GENESIS_BLOCK + 200 * 600, 600):
|
||||
self.nodes[0].setmocktime(t)
|
||||
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
|
||||
self.generate(self.wallet, 1, sync_fun=self.no_op)
|
||||
mining_info = self.nodes[0].getmininginfo()
|
||||
assert_equal(mining_info['blocks'], 200)
|
||||
assert_equal(mining_info['currentblocktx'], 0)
|
||||
@ -75,8 +74,9 @@ class MiningTest(BitcoinTestFramework):
|
||||
self.connect_nodes(0, 1)
|
||||
|
||||
def run_test(self):
|
||||
self.mine_chain()
|
||||
node = self.nodes[0]
|
||||
self.wallet = MiniWallet(node)
|
||||
self.mine_chain()
|
||||
|
||||
def assert_submitblock(block, result_str_1, result_str_2=None):
|
||||
block.solve()
|
||||
@ -95,7 +95,7 @@ class MiningTest(BitcoinTestFramework):
|
||||
assert_equal(mining_info['pooledtx'], 0)
|
||||
|
||||
self.log.info("getblocktemplate: Test default witness commitment")
|
||||
txid = int(node.sendtoaddress(node.getnewaddress(), 1), 16)
|
||||
txid = int(self.wallet.send_self_transfer(from_node=node)['wtxid'], 16)
|
||||
tmpl = node.getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)
|
||||
|
||||
# Check that default_witness_commitment is present.
|
||||
|
Loading…
Reference in New Issue
Block a user