Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet_multiwallet.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2017-2019 The Bitcoin Core developers | # Copyright (c) 2017-2019 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
"""Test multiwallet. | """Test multiwallet. | ||||
Verify that a bitcoind node can load multiple wallet files | Verify that a bitcoind node can load multiple wallet files | ||||
""" | """ | ||||
from decimal import Decimal | |||||
import os | import os | ||||
import shutil | import shutil | ||||
import time | import time | ||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.test_node import ErrorMatch | from test_framework.test_node import ErrorMatch | ||||
from test_framework.util import ( | from test_framework.util import ( | ||||
assert_equal, | assert_equal, | ||||
▲ Show 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
batch = w1.batch([w1.getblockchaininfo.get_request(), | batch = w1.batch([w1.getblockchaininfo.get_request(), | ||||
w1.getwalletinfo.get_request()]) | w1.getwalletinfo.get_request()]) | ||||
assert_equal(batch[0]["result"]["chain"], self.chain) | assert_equal(batch[0]["result"]["chain"], self.chain) | ||||
assert_equal(batch[1]["result"]["walletname"], "w1") | assert_equal(batch[1]["result"]["walletname"], "w1") | ||||
self.log.info('Check for per-wallet settxfee call') | self.log.info('Check for per-wallet settxfee call') | ||||
assert_equal(w1.getwalletinfo()['paytxfee'], 0) | assert_equal(w1.getwalletinfo()['paytxfee'], 0) | ||||
assert_equal(w2.getwalletinfo()['paytxfee'], 0) | assert_equal(w2.getwalletinfo()['paytxfee'], 0) | ||||
w2.settxfee(4.0) | w2.settxfee(0.001) | ||||
assert_equal(w1.getwalletinfo()['paytxfee'], 0) | assert_equal(w1.getwalletinfo()['paytxfee'], 0) | ||||
assert_equal(w2.getwalletinfo()['paytxfee'], 4.0) | assert_equal(w2.getwalletinfo()['paytxfee'], Decimal('0.00100000')) | ||||
self.log.info("Test dynamic wallet loading") | self.log.info("Test dynamic wallet loading") | ||||
self.restart_node(0, ['-nowallet']) | self.restart_node(0, ['-nowallet']) | ||||
assert_equal(node.listwallets(), []) | assert_equal(node.listwallets(), []) | ||||
assert_raises_rpc_error(-32601, "Method not found", node.getwalletinfo) | assert_raises_rpc_error(-32601, "Method not found", node.getwalletinfo) | ||||
self.log.info("Load first wallet") | self.log.info("Load first wallet") | ||||
▲ Show 20 Lines • Show All 160 Lines • Show Last 20 Lines |