Changeset View
Changeset View
Standalone View
Standalone View
test/functional/interface_bitcoin_cli.py
Show All 9 Lines | from test_framework.util import ( | ||||
assert_raises_process_error, | assert_raises_process_error, | ||||
get_auth_cookie, | get_auth_cookie, | ||||
) | ) | ||||
# The block reward of coinbaseoutput.nValue (50) BTC/block matures after | # The block reward of coinbaseoutput.nValue (50) BTC/block matures after | ||||
# COINBASE_MATURITY (100) blocks. Therefore, after mining 101 blocks we expect | # COINBASE_MATURITY (100) blocks. Therefore, after mining 101 blocks we expect | ||||
# node 0 to have a balance of (BLOCKS - COINBASE_MATURITY) * 50 BTC/block. | # node 0 to have a balance of (BLOCKS - COINBASE_MATURITY) * 50 BTC/block. | ||||
BLOCKS = 101 | BLOCKS = 101 | ||||
BALANCE = (BLOCKS - 100) * 50 | BALANCE = (BLOCKS - 100) * 50000000 | ||||
class TestBitcoinCli(BitcoinTestFramework): | class TestBitcoinCli(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
def skip_test_if_missing_module(self): | def skip_test_if_missing_module(self): | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
wallet_info['unlocked_until']) | wallet_info['unlocked_until']) | ||||
assert_equal(cli_get_info['paytxfee'], wallet_info['paytxfee']) | assert_equal(cli_get_info['paytxfee'], wallet_info['paytxfee']) | ||||
assert_equal(cli_get_info['relayfee'], network_info['relayfee']) | assert_equal(cli_get_info['relayfee'], network_info['relayfee']) | ||||
assert_equal(self.nodes[0].cli.getwalletinfo(), wallet_info) | assert_equal(self.nodes[0].cli.getwalletinfo(), wallet_info) | ||||
# Setup to test -getinfo and -rpcwallet= with multiple wallets. | # Setup to test -getinfo and -rpcwallet= with multiple wallets. | ||||
wallets = ['', 'Encrypted', 'secret'] | wallets = ['', 'Encrypted', 'secret'] | ||||
amounts = [ | amounts = [ | ||||
BALANCE + Decimal('9.99999550'), | BALANCE + Decimal('9999995.50'), | ||||
Decimal(9), | Decimal(9000000), | ||||
Decimal(31)] | Decimal(31000000)] | ||||
self.nodes[0].createwallet(wallet_name=wallets[1]) | self.nodes[0].createwallet(wallet_name=wallets[1]) | ||||
self.nodes[0].createwallet(wallet_name=wallets[2]) | self.nodes[0].createwallet(wallet_name=wallets[2]) | ||||
w1 = self.nodes[0].get_wallet_rpc(wallets[0]) | w1 = self.nodes[0].get_wallet_rpc(wallets[0]) | ||||
w2 = self.nodes[0].get_wallet_rpc(wallets[1]) | w2 = self.nodes[0].get_wallet_rpc(wallets[1]) | ||||
w3 = self.nodes[0].get_wallet_rpc(wallets[2]) | w3 = self.nodes[0].get_wallet_rpc(wallets[2]) | ||||
w1.walletpassphrase(password, self.rpc_timeout) | w1.walletpassphrase(password, self.rpc_timeout) | ||||
w2.encryptwallet(password) | w2.encryptwallet(password) | ||||
w1.sendtoaddress(w2.getnewaddress(), amounts[1]) | w1.sendtoaddress(w2.getnewaddress(), amounts[1]) | ||||
▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines |