aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorbarrystyle <[email protected]>2021-02-20 20:13:43 +0800
committerGitHub <[email protected]>2021-02-20 12:13:43 +0000
commit8f77f8870dcff8d22c4339cd72269cf71a8b1265 (patch)
tree418715cc6d3f5f019f8e596b6b784d5247b67eec /test/functional
parentMerge #20933: [0.21] doc: Archive release notes, Add template for minor release (diff)
downloaddiscoin-8f77f8870dcff8d22c4339cd72269cf71a8b1265.tar.xz
discoin-8f77f8870dcff8d22c4339cd72269cf71a8b1265.zip
1.21 codebase rebrand (#1711)
* build: Brand codebase as Dogecoin via automake/autoconf files. * build: Update internal resource files for windows builds. * build: Update internal application names and data directories. * build: Update immediately visible remaining bitcoin name references from cli binaries and qt. * build: Update immediately visible bitcoin references in the main gui itself. * Update functional tests to match Dogecoin * wallet: Add missing check for -descriptors wallet tool option * correct output for functional tests (errorlevels?) Co-authored-by: Ross Nicoll <[email protected]> Co-authored-by: MarcoFalke <[email protected]>
Diffstat (limited to 'test/functional')
-rwxr-xr-xtest/functional/feature_config_args.py6
-rwxr-xr-xtest/functional/feature_includeconf.py4
-rwxr-xr-xtest/functional/feature_settings.py2
-rwxr-xr-xtest/functional/rpc_fundrawtransaction.py6
-rwxr-xr-xtest/functional/rpc_psbt.py6
-rwxr-xr-xtest/functional/rpc_users.py4
-rwxr-xr-xtest/functional/rpc_whitelist.py2
-rwxr-xr-xtest/functional/test_framework/test_framework.py14
-rwxr-xr-xtest/functional/test_framework/test_node.py18
-rw-r--r--test/functional/test_framework/util.py9
-rwxr-xr-xtest/functional/test_runner.py2
-rwxr-xr-xtest/functional/tool_wallet.py88
-rwxr-xr-xtest/functional/wallet_basic.py16
-rwxr-xr-xtest/functional/wallet_bumpfee.py2
-rwxr-xr-xtest/functional/wallet_multiwallet.py4
-rwxr-xr-xtest/functional/wallet_send.py16
16 files changed, 140 insertions, 59 deletions
diff --git a/test/functional/feature_config_args.py b/test/functional/feature_config_args.py
index 3e28dae4b..dd7180082 100755
--- a/test/functional/feature_config_args.py
+++ b/test/functional/feature_config_args.py
@@ -20,7 +20,7 @@ class ConfArgsTest(BitcoinTestFramework):
# Assume node is stopped
inc_conf_file_path = os.path.join(self.nodes[0].datadir, 'include.conf')
- with open(os.path.join(self.nodes[0].datadir, 'bitcoin.conf'), 'a', encoding='utf-8') as conf:
+ with open(os.path.join(self.nodes[0].datadir, 'dogecoin.conf'), 'a', encoding='utf-8') as conf:
conf.write('includeconf={}\n'.format(inc_conf_file_path))
self.nodes[0].assert_start_raises_init_error(
@@ -64,7 +64,7 @@ class ConfArgsTest(BitcoinTestFramework):
self.nodes[0].assert_start_raises_init_error(expected_msg='Error: Error reading configuration file: parse error on line 4, using # in rpcpassword can be ambiguous and should be avoided')
inc_conf_file2_path = os.path.join(self.nodes[0].datadir, 'include2.conf')
- with open(os.path.join(self.nodes[0].datadir, 'bitcoin.conf'), 'a', encoding='utf-8') as conf:
+ with open(os.path.join(self.nodes[0].datadir, 'dogecoin.conf'), 'a', encoding='utf-8') as conf:
conf.write('includeconf={}\n'.format(inc_conf_file2_path))
with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
@@ -167,7 +167,7 @@ class ConfArgsTest(BitcoinTestFramework):
self.nodes[0].assert_start_raises_init_error(['-datadir=' + new_data_dir], 'Error: Specified data directory "' + new_data_dir + '" does not exist.')
# Check that using non-existent datadir in conf file fails
- conf_file = os.path.join(default_data_dir, "bitcoin.conf")
+ conf_file = os.path.join(default_data_dir, "dogecoin.conf")
# datadir needs to be set before [chain] section
conf_file_contents = open(conf_file, encoding='utf8').read()
diff --git a/test/functional/feature_includeconf.py b/test/functional/feature_includeconf.py
index 6f1a0cd34..0b484ef58 100755
--- a/test/functional/feature_includeconf.py
+++ b/test/functional/feature_includeconf.py
@@ -32,7 +32,7 @@ class IncludeConfTest(BitcoinTestFramework):
# - tmpdir/node0/relative2.conf
with open(os.path.join(self.options.tmpdir, "node0", "relative2.conf"), "w", encoding="utf8") as f:
f.write("uacomment=relative2\n")
- with open(os.path.join(self.options.tmpdir, "node0", "bitcoin.conf"), "a", encoding='utf8') as f:
+ with open(os.path.join(self.options.tmpdir, "node0", "dogecoin.conf"), "a", encoding='utf8') as f:
f.write("uacomment=main\nincludeconf=relative.conf\n")
def run_test(self):
@@ -70,7 +70,7 @@ class IncludeConfTest(BitcoinTestFramework):
# Restore initial file contents
f.write("uacomment=relative\n")
- with open(os.path.join(self.options.tmpdir, "node0", "bitcoin.conf"), "a", encoding='utf8') as f:
+ with open(os.path.join(self.options.tmpdir, "node0", "dogecoin.conf"), "a", encoding='utf8') as f:
f.write("includeconf=relative2.conf\n")
self.start_node(0)
diff --git a/test/functional/feature_settings.py b/test/functional/feature_settings.py
index 5a0236401..4134343f6 100755
--- a/test/functional/feature_settings.py
+++ b/test/functional/feature_settings.py
@@ -22,7 +22,7 @@ class SettingsTest(BitcoinTestFramework):
def run_test(self):
node, = self.nodes
settings = Path(node.datadir, self.chain, "settings.json")
- conf = Path(node.datadir, "bitcoin.conf")
+ conf = Path(node.datadir, "dogecoin.conf")
# Assert empty settings file was created
self.stop_node(0)
diff --git a/test/functional/rpc_fundrawtransaction.py b/test/functional/rpc_fundrawtransaction.py
index 569471dc8..4e7ecada4 100755
--- a/test/functional/rpc_fundrawtransaction.py
+++ b/test/functional/rpc_fundrawtransaction.py
@@ -707,7 +707,7 @@ class RawTransactionsTest(BitcoinTestFramework):
wwatch.unloadwallet()
def test_option_feerate(self):
- self.log.info("Test fundrawtxn with explicit fee rates (fee_rate sat/vB and feeRate BTC/kvB)")
+ self.log.info("Test fundrawtxn with explicit fee rates (fee_rate koinu/vB and feeRate DOGE/kvB)")
node = self.nodes[3]
# Make sure there is exactly one input so coin selection can't skew the result.
assert_equal(len(self.nodes[3].listunspent(1)), 1)
@@ -768,12 +768,12 @@ class RawTransactionsTest(BitcoinTestFramework):
assert_raises_rpc_error(-3, "Invalid amount",
node.fundrawtransaction, rawtx, {param: "", "add_inputs": True})
- self.log.info("Test min fee rate checks are bypassed with fundrawtxn, e.g. a fee_rate under 1 sat/vB is allowed")
+ self.log.info("Test min fee rate checks are bypassed with fundrawtxn, e.g. a fee_rate under 1 koinu/vB is allowed")
node.fundrawtransaction(rawtx, {"fee_rate": 0.99999999, "add_inputs": True})
node.fundrawtransaction(rawtx, {"feeRate": 0.00000999, "add_inputs": True})
self.log.info("- raises RPC error if both feeRate and fee_rate are passed")
- assert_raises_rpc_error(-8, "Cannot specify both fee_rate (sat/vB) and feeRate (BTC/kvB)",
+ assert_raises_rpc_error(-8, "Cannot specify both fee_rate (koinu/vB) and feeRate (DOGE/kvB)",
node.fundrawtransaction, rawtx, {"fee_rate": 0.1, "feeRate": 0.1, "add_inputs": True})
self.log.info("- raises RPC error if both feeRate and estimate_mode passed")
diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py
index b364077a9..8e8630621 100755
--- a/test/functional/rpc_psbt.py
+++ b/test/functional/rpc_psbt.py
@@ -187,13 +187,13 @@ class PSBTTest(BitcoinTestFramework):
assert_equal(walletprocesspsbt_out['complete'], True)
self.nodes[1].sendrawtransaction(self.nodes[1].finalizepsbt(walletprocesspsbt_out['psbt'])['hex'])
- self.log.info("Test walletcreatefundedpsbt fee rate of 10000 sat/vB and 0.1 BTC/kvB produces a total fee at or slightly below -maxtxfee (~0.05290000)")
+ self.log.info("Test walletcreatefundedpsbt fee rate of 10000 koinu/vB and 0.1 DOGE/kvB produces a total fee at or slightly below -maxtxfee (~0.05290000)")
res1 = self.nodes[1].walletcreatefundedpsbt(inputs, outputs, 0, {"fee_rate": 10000, "add_inputs": True})
assert_approx(res1["fee"], 0.055, 0.005)
res2 = self.nodes[1].walletcreatefundedpsbt(inputs, outputs, 0, {"feeRate": "0.1", "add_inputs": True})
assert_approx(res2["fee"], 0.055, 0.005)
- self.log.info("Test min fee rate checks with walletcreatefundedpsbt are bypassed, e.g. a fee_rate under 1 sat/vB is allowed")
+ self.log.info("Test min fee rate checks with walletcreatefundedpsbt are bypassed, e.g. a fee_rate under 1 koinu/vB is allowed")
res3 = self.nodes[1].walletcreatefundedpsbt(inputs, outputs, 0, {"fee_rate": "0.99999999", "add_inputs": True})
assert_approx(res3["fee"], 0.00000381, 0.0000001)
res4 = self.nodes[1].walletcreatefundedpsbt(inputs, outputs, 0, {"feeRate": 0.00000999, "add_inputs": True})
@@ -215,7 +215,7 @@ class PSBTTest(BitcoinTestFramework):
self.nodes[1].walletcreatefundedpsbt, inputs, outputs, 0, {param: "", "add_inputs": True})
self.log.info("- raises RPC error if both feeRate and fee_rate are passed")
- assert_raises_rpc_error(-8, "Cannot specify both fee_rate (sat/vB) and feeRate (BTC/kvB)",
+ assert_raises_rpc_error(-8, "Cannot specify both fee_rate (koinu/vB) and feeRate (DOGE/kvB)",
self.nodes[1].walletcreatefundedpsbt, inputs, outputs, 0, {"fee_rate": 0.1, "feeRate": 0.1, "add_inputs": True})
self.log.info("- raises RPC error if both feeRate and estimate_mode passed")
diff --git a/test/functional/rpc_users.py b/test/functional/rpc_users.py
index daf02fc4f..6e8c9307a 100755
--- a/test/functional/rpc_users.py
+++ b/test/functional/rpc_users.py
@@ -64,11 +64,11 @@ class HTTPBasicsTest(BitcoinTestFramework):
rpcauth3 = lines[1]
self.password = lines[3]
- with open(os.path.join(get_datadir_path(self.options.tmpdir, 0), "bitcoin.conf"), 'a', encoding='utf8') as f:
+ with open(os.path.join(get_datadir_path(self.options.tmpdir, 0), "dogecoin.conf"), 'a', encoding='utf8') as f:
f.write(rpcauth + "\n")
f.write(rpcauth2 + "\n")
f.write(rpcauth3 + "\n")
- with open(os.path.join(get_datadir_path(self.options.tmpdir, 1), "bitcoin.conf"), 'a', encoding='utf8') as f:
+ with open(os.path.join(get_datadir_path(self.options.tmpdir, 1), "dogecoin.conf"), 'a', encoding='utf8') as f:
f.write("rpcuser={}\n".format(self.rpcuser))
f.write("rpcpassword={}\n".format(self.rpcpassword))
diff --git a/test/functional/rpc_whitelist.py b/test/functional/rpc_whitelist.py
index 219132410..df2dd2269 100755
--- a/test/functional/rpc_whitelist.py
+++ b/test/functional/rpc_whitelist.py
@@ -55,7 +55,7 @@ class RPCWhitelistTest(BitcoinTestFramework):
]
# These commands shouldn't be allowed for any user to test failures
self.never_allowed = ["getnetworkinfo"]
- with open(os.path.join(get_datadir_path(self.options.tmpdir, 0), "bitcoin.conf"), 'a', encoding='utf8') as f:
+ with open(os.path.join(get_datadir_path(self.options.tmpdir, 0), "dogecoin.conf"), 'a', encoding='utf8') as f:
f.write("\nrpcwhitelistdefault=0\n")
for user in self.users:
f.write("rpcauth=" + user[0] + ":" + user[1] + "\n")
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index 831599913..f71e1a48b 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -210,12 +210,12 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
fname_bitcoind = os.path.join(
config["environment"]["BUILDDIR"],
"src",
- "bitcoind" + config["environment"]["EXEEXT"],
+ "dogecoind" + config["environment"]["EXEEXT"],
)
fname_bitcoincli = os.path.join(
config["environment"]["BUILDDIR"],
"src",
- "bitcoin-cli" + config["environment"]["EXEEXT"],
+ "dogecoin-cli" + config["environment"]["EXEEXT"],
)
self.options.bitcoind = os.getenv("BITCOIND", default=fname_bitcoind)
self.options.bitcoincli = os.getenv("BITCOINCLI", default=fname_bitcoincli)
@@ -446,9 +446,9 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
if versions is None:
versions = [None] * num_nodes
if binary is None:
- binary = [get_bin_from_version(v, 'bitcoind', self.options.bitcoind) for v in versions]
+ binary = [get_bin_from_version(v, 'dogecoind', self.options.bitcoind) for v in versions]
if binary_cli is None:
- binary_cli = [get_bin_from_version(v, 'bitcoin-cli', self.options.bitcoincli) for v in versions]
+ binary_cli = [get_bin_from_version(v, 'dogecoin-cli', self.options.bitcoincli) for v in versions]
assert_equal(len(extra_confs), num_nodes)
assert_equal(len(extra_args), num_nodes)
assert_equal(len(versions), num_nodes)
@@ -768,7 +768,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
def skip_if_no_bitcoind_zmq(self):
"""Skip the running test if bitcoind has not been compiled with zmq support."""
if not self.is_zmq_compiled():
- raise SkipTest("bitcoind has not been built with zmq enabled.")
+ raise SkipTest("dogecoind has not been built with zmq enabled.")
def skip_if_no_wallet(self):
"""Skip the running test if wallet has not been compiled."""
@@ -785,12 +785,12 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
def skip_if_no_wallet_tool(self):
"""Skip the running test if bitcoin-wallet has not been compiled."""
if not self.is_wallet_tool_compiled():
- raise SkipTest("bitcoin-wallet has not been compiled")
+ raise SkipTest("dogecoin-wallet has not been compiled")
def skip_if_no_cli(self):
"""Skip the running test if bitcoin-cli has not been compiled."""
if not self.is_cli_compiled():
- raise SkipTest("bitcoin-cli has not been compiled.")
+ raise SkipTest("dogecoin-cli has not been compiled.")
def skip_if_no_previous_releases(self):
"""Skip the running test if previous releases are not available."""
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py
index 046efe730..91341ca0e 100755
--- a/test/functional/test_framework/test_node.py
+++ b/test/functional/test_framework/test_node.py
@@ -72,7 +72,7 @@ class TestNode():
self.index = i
self.datadir = datadir
- self.bitcoinconf = os.path.join(self.datadir, "bitcoin.conf")
+ self.bitcoinconf = os.path.join(self.datadir, "dogecoin.conf")
self.stdout_dir = os.path.join(self.datadir, "stdout")
self.stderr_dir = os.path.join(self.datadir, "stderr")
self.chain = chain
@@ -218,7 +218,7 @@ class TestNode():
for _ in range(poll_per_s * self.rpc_timeout):
if self.process.poll() is not None:
raise FailedToStartError(self._node_msg(
- 'bitcoind exited with status {} during initialization'.format(self.process.returncode)))
+ 'dogecoind exited with status {} during initialization'.format(self.process.returncode)))
try:
rpc = get_rpc_proxy(
rpc_url(self.datadir, self.index, self.chain, self.rpchost),
@@ -276,7 +276,7 @@ class TestNode():
if "No RPC credentials" not in str(e):
raise
time.sleep(1.0 / poll_per_s)
- self._raise_assertion_error("Unable to connect to bitcoind after {}s".format(self.rpc_timeout))
+ self._raise_assertion_error("Unable to connect to dogecoind after {}s".format(self.rpc_timeout))
def wait_for_cookie_credentials(self):
"""Ensures auth cookie credentials can be read, e.g. for testing CLI with -rpcwait before RPC connection is up."""
@@ -432,7 +432,7 @@ class TestNode():
if not test_success('readelf -S {} | grep .debug_str'.format(shlex.quote(self.binary))):
self.log.warning(
- "perf output won't be very useful without debug symbols compiled into bitcoind")
+ "perf output won't be very useful without debug symbols compiled into dogecoind")
output_path = tempfile.NamedTemporaryFile(
dir=self.datadir,
@@ -486,7 +486,7 @@ class TestNode():
self.stop_node()
self.wait_until_stopped()
except FailedToStartError as e:
- self.log.debug('bitcoind failed to start: %s', e)
+ self.log.debug('dogecoind failed to start: %s', e)
self.running = False
self.process = None
# Check stderr for expected message
@@ -507,9 +507,9 @@ class TestNode():
'Expected message "{}" does not fully match stderr:\n"{}"'.format(expected_msg, stderr))
else:
if expected_msg is None:
- assert_msg = "bitcoind should have exited with an error"
+ assert_msg = "dogecoind should have exited with an error"
else:
- assert_msg = "bitcoind should have exited with expected error " + expected_msg
+ assert_msg = "dogecoind should have exited with expected error " + expected_msg
self._raise_assertion_error(assert_msg)
def add_p2p_connection(self, p2p_conn, *, wait_for_verack=True, **kwargs):
@@ -584,7 +584,7 @@ class TestNodeCLI():
self.binary = binary
self.datadir = datadir
self.input = None
- self.log = logging.getLogger('TestFramework.bitcoincli')
+ self.log = logging.getLogger('TestFramework.dogecoincli')
def __call__(self, *options, input=None):
# TestNodeCLI is callable with bitcoin-cli command-line options
@@ -616,7 +616,7 @@ class TestNodeCLI():
if command is not None:
p_args += [command]
p_args += pos_args + named_args
- self.log.debug("Running bitcoin-cli {}".format(p_args[2:]))
+ self.log.debug("Running dogecoin-cli {}".format(p_args[2:]))
process = subprocess.Popen(p_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
cli_stdout, cli_stderr = process.communicate(input=self.input)
returncode = process.poll()
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
index 62ff5c6e3..9f52b4e81 100644
--- a/test/functional/test_framework/util.py
+++ b/test/functional/test_framework/util.py
@@ -304,6 +304,7 @@ def get_rpc_proxy(url, node_number, *, timeout=None, coveragedir=None):
if timeout is not None:
proxy_kwargs['timeout'] = int(timeout)
+ print("Proxy: " + url)
proxy = AuthServiceProxy(url, **proxy_kwargs)
proxy.url = url # store URL on proxy for info
@@ -349,7 +350,7 @@ def initialize_datadir(dirname, n, chain):
else:
chain_name_conf_arg = chain
chain_name_conf_section = chain
- with open(os.path.join(datadir, "bitcoin.conf"), 'w', encoding='utf8') as f:
+ with open(os.path.join(datadir, "dogecoin.conf"), 'w', encoding='utf8') as f:
f.write("{}=1\n".format(chain_name_conf_arg))
f.write("[{}]\n".format(chain_name_conf_section))
f.write("port=" + str(p2p_port(n)) + "\n")
@@ -373,7 +374,7 @@ def get_datadir_path(dirname, n):
def append_config(datadir, options):
- with open(os.path.join(datadir, "bitcoin.conf"), 'a', encoding='utf8') as f:
+ with open(os.path.join(datadir, "dogecoin.conf"), 'a', encoding='utf8') as f:
for option in options:
f.write(option + "\n")
@@ -381,8 +382,8 @@ def append_config(datadir, options):
def get_auth_cookie(datadir, chain):
user = None
password = None
- if os.path.isfile(os.path.join(datadir, "bitcoin.conf")):
- with open(os.path.join(datadir, "bitcoin.conf"), 'r', encoding='utf8') as f:
+ if os.path.isfile(os.path.join(datadir, "dogecoin.conf")):
+ with open(os.path.join(datadir, "dogecoin.conf"), 'r', encoding='utf8') as f:
for line in f:
if line.startswith("rpcuser="):
assert user is None # Ensure that there is only one rpcuser line
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py
index 5b3db282e..09756e4ad 100755
--- a/test/functional/test_runner.py
+++ b/test/functional/test_runner.py
@@ -344,7 +344,7 @@ def main():
logging.basicConfig(format='%(message)s', level=logging_level)
# Create base test directory
- tmpdir = "%s/test_runner_₿_🏃_%s" % (args.tmpdirprefix, datetime.datetime.now().strftime("%Y%m%d_%H%M%S"))
+ tmpdir = "%s/test_runner_Đ_🏃_%s" % (args.tmpdirprefix, datetime.datetime.now().strftime("%Y%m%d_%H%M%S"))
os.makedirs(tmpdir)
diff --git a/test/functional/tool_wallet.py b/test/functional/tool_wallet.py
index 615b772dc..597ccaaf5 100755
--- a/test/functional/tool_wallet.py
+++ b/test/functional/tool_wallet.py
@@ -27,9 +27,12 @@ class ToolWalletTest(BitcoinTestFramework):
self.skip_if_no_wallet_tool()
def bitcoin_wallet_process(self, *args):
- binary = self.config["environment"]["BUILDDIR"] + '/src/bitcoin-wallet' + self.config["environment"]["EXEEXT"]
- args = ['-datadir={}'.format(self.nodes[0].datadir), '-chain=%s' % self.chain] + list(args)
- return subprocess.Popen([binary] + args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
+ binary = self.config["environment"]["BUILDDIR"] + '/src/dogecoin-wallet' + self.config["environment"]["EXEEXT"]
+ default_args = ['-datadir={}'.format(self.nodes[0].datadir), '-chain=%s' % self.chain]
+ if self.options.descriptors and 'create' in args:
+ default_args.append('-descriptors')
+
+ return subprocess.Popen([binary] + default_args + list(args), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
def assert_raises_tool_error(self, error, *args):
p = self.bitcoin_wallet_process(*args)
@@ -73,7 +76,7 @@ class ToolWalletTest(BitcoinTestFramework):
locked_dir = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets")
error = 'Error initializing wallet database environment "{}"!'.format(locked_dir)
if self.options.descriptors:
- error = "SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another bitcoind?"
+ error = "SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another dogecoind?"
self.assert_raises_tool_error(
error,
'-wallet=' + self.default_wallet_name,
@@ -255,6 +258,83 @@ class ToolWalletTest(BitcoinTestFramework):
self.assert_tool_output('', '-wallet=salvage', 'salvage')
+ def test_dump_createfromdump(self):
+ self.start_node(0)
+ self.nodes[0].createwallet("todump")
+ file_format = self.nodes[0].get_wallet_rpc("todump").getwalletinfo()["format"]
+ self.nodes[0].createwallet("todump2")
+ self.stop_node(0)
+
+ self.log.info('Checking dump arguments')
+ self.assert_raises_tool_error('No dump file provided. To use dump, -dumpfile=<filename> must be provided.', '-wallet=todump', 'dump')
+
+ self.log.info('Checking basic dump')
+ wallet_dump = os.path.join(self.nodes[0].datadir, "wallet.dump")
+ self.assert_tool_output('The dumpfile may contain private keys. To ensure the safety of your Bitcoin, do not share the dumpfile.\n', '-wallet=todump', '-dumpfile={}'.format(wallet_dump), 'dump')
+
+ dump_data = self.read_dump(wallet_dump)
+ orig_dump = dump_data.copy()
+ # Check the dump magic
+ assert_equal(dump_data['DOGECOIN_CORE_WALLET_DUMP'], '1')
+ # Check the file format
+ assert_equal(dump_data["format"], file_format)
+
+ self.log.info('Checking that a dumpfile cannot be overwritten')
+ self.assert_raises_tool_error('File {} already exists. If you are sure this is what you want, move it out of the way first.'.format(wallet_dump), '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'dump')
+
+ self.log.info('Checking createfromdump arguments')
+ self.assert_raises_tool_error('No dump file provided. To use createfromdump, -dumpfile=<filename> must be provided.', '-wallet=todump', 'createfromdump')
+ non_exist_dump = os.path.join(self.nodes[0].datadir, "wallet.nodump")
+ self.assert_raises_tool_error('Unknown wallet file format "notaformat" provided. Please provide one of "bdb" or "sqlite".', '-wallet=todump', '-format=notaformat', '-dumpfile={}'.format(wallet_dump), 'createfromdump')
+ self.assert_raises_tool_error('Dump file {} does not exist.'.format(non_exist_dump), '-wallet=todump', '-dumpfile={}'.format(non_exist_dump), 'createfromdump')
+ wallet_path = os.path.join(self.nodes[0].datadir, 'regtest/wallets/todump2')
+ self.assert_raises_tool_error('Failed to create database path \'{}\'. Database already exists.'.format(wallet_path), '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump')
+ self.assert_raises_tool_error("The -descriptors option can only be used with the 'create' command.", '-descriptors', '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump')
+
+ self.log.info('Checking createfromdump')
+ self.do_tool_createfromdump("load", "wallet.dump")
+ self.do_tool_createfromdump("load-bdb", "wallet.dump", "bdb")
+ if self.is_sqlite_compiled():
+ self.do_tool_createfromdump("load-sqlite", "wallet.dump", "sqlite")
+
+ self.log.info('Checking createfromdump handling of magic and versions')
+ bad_ver_wallet_dump = os.path.join(self.nodes[0].datadir, "wallet-bad_ver1.dump")
+ dump_data["DOGECOIN_CORE_WALLET_DUMP"] = "0"
+ self.write_dump(dump_data, bad_ver_wallet_dump)
+ self.assert_raises_tool_error('Error: Dumpfile version is not supported. This version of dogecoin-wallet only supports version 1 dumpfiles. Got dumpfile with version 0', '-wallet=badload', '-dumpfile={}'.format(bad_ver_wallet_dump), 'createfromdump')
+ assert not os.path.isdir(os.path.join(self.nodes[0].datadir, "regtest/wallets", "badload"))
+ bad_ver_wallet_dump = os.path.join(self.nodes[0].datadir, "wallet-bad_ver2.dump")
+ dump_data["DOGECOIN_CORE_WALLET_DUMP"] = "2"
+ self.write_dump(dump_data, bad_ver_wallet_dump)
+ self.assert_raises_tool_error('Error: Dumpfile version is not supported. This version of dogecoin-wallet only supports version 1 dumpfiles. Got dumpfile with version 2', '-wallet=badload', '-dumpfile={}'.format(bad_ver_wallet_dump), 'createfromdump')
+ assert not os.path.isdir(os.path.join(self.nodes[0].datadir, "regtest/wallets", "badload"))
+ bad_magic_wallet_dump = os.path.join(self.nodes[0].datadir, "wallet-bad_magic.dump")
+ del dump_data["DOGECOIN_CORE_WALLET_DUMP"]
+ dump_data["not_the_right_magic"] = "1"
+ self.write_dump(dump_data, bad_magic_wallet_dump, "not_the_right_magic")
+ self.assert_raises_tool_error('Error: Dumpfile identifier record is incorrect. Got "not_the_right_magic", expected "DOGECOIN_CORE_WALLET_DUMP".', '-wallet=badload', '-dumpfile={}'.format(bad_magic_wallet_dump), 'createfromdump')
+ assert not os.path.isdir(os.path.join(self.nodes[0].datadir, "regtest/wallets", "badload"))
+
+ self.log.info('Checking createfromdump handling of checksums')
+ bad_sum_wallet_dump = os.path.join(self.nodes[0].datadir, "wallet-bad_sum1.dump")
+ dump_data = orig_dump.copy()
+ checksum = dump_data["checksum"]
+ dump_data["checksum"] = "1" * 64
+ self.write_dump(dump_data, bad_sum_wallet_dump)
+ self.assert_raises_tool_error('Error: Dumpfile checksum does not match. Computed {}, expected {}'.format(checksum, "1" * 64), '-wallet=bad', '-dumpfile={}'.format(bad_sum_wallet_dump), 'createfromdump')
+ assert not os.path.isdir(os.path.join(self.nodes[0].datadir, "regtest/wallets", "badload"))
+ bad_sum_wallet_dump = os.path.join(self.nodes[0].datadir, "wallet-bad_sum2.dump")
+ del dump_data["checksum"]
+ self.write_dump(dump_data, bad_sum_wallet_dump, skip_checksum=True)
+ self.assert_raises_tool_error('Error: Missing checksum', '-wallet=badload', '-dumpfile={}'.format(bad_sum_wallet_dump), 'createfromdump')
+ assert not os.path.isdir(os.path.join(self.nodes[0].datadir, "regtest/wallets", "badload"))
+ bad_sum_wallet_dump = os.path.join(self.nodes[0].datadir, "wallet-bad_sum3.dump")
+ dump_data["checksum"] = "2" * 10
+ self.write_dump(dump_data, bad_sum_wallet_dump)
+ self.assert_raises_tool_error('Error: Dumpfile checksum does not match. Computed {}, expected {}{}'.format(checksum, "2" * 10, "0" * 54), '-wallet=badload', '-dumpfile={}'.format(bad_sum_wallet_dump), 'createfromdump')
+ assert not os.path.isdir(os.path.join(self.nodes[0].datadir, "regtest/wallets", "badload"))
+
+
def run_test(self):
self.wallet_path = os.path.join(self.nodes[0].datadir, self.chain, 'wallets', self.default_wallet_name, self.wallet_data_filename)
self.test_invalid_tool_commands_and_args()
diff --git a/test/functional/wallet_basic.py b/test/functional/wallet_basic.py
index 3cbddaf6d..a15f0c1cc 100755
--- a/test/functional/wallet_basic.py
+++ b/test/functional/wallet_basic.py
@@ -230,7 +230,7 @@ class WalletTest(BitcoinTestFramework):
assert_equal(self.nodes[2].getbalance(), node_2_bal)
node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), node_0_bal + Decimal('10'), fee_per_byte, self.get_vsize(self.nodes[2].gettransaction(txid)['hex']))
- self.log.info("Test sendmany with fee_rate param (explicit fee rate in sat/vB)")
+ self.log.info("Test sendmany with fee_rate param (explicit fee rate in koinu/vB)")
fee_rate_sat_vb = 2
fee_rate_btc_kvb = fee_rate_sat_vb * 1e3 / 1e8
explicit_fee_rate_btc_kvb = Decimal(fee_rate_btc_kvb) / 1000
@@ -261,11 +261,11 @@ class WalletTest(BitcoinTestFramework):
# Test setting explicit fee rate just below the minimum.
self.log.info("Test sendmany raises 'fee rate too low' if fee_rate of 0.99999999 is passed")
- assert_raises_rpc_error(-6, "Fee rate (0.999 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB)",
+ assert_raises_rpc_error(-6, "Fee rate (0.999 koinu/vB) is lower than the minimum fee rate setting (1.000 koinu/vB)",
self.nodes[2].sendmany, amounts={address: 10}, fee_rate=0.99999999)
self.log.info("Test sendmany raises if fee_rate of 0 or -1 is passed")
- assert_raises_rpc_error(-6, "Fee rate (0.000 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB)",
+ assert_raises_rpc_error(-6, "Fee rate (0.000 koinu/vB) is lower than the minimum fee rate setting (1.000 koinu/vB)",
self.nodes[2].sendmany, amounts={address: 10}, fee_rate=0)
assert_raises_rpc_error(-3, OUT_OF_RANGE, self.nodes[2].sendmany, amounts={address: 10}, fee_rate=-1)
@@ -273,7 +273,7 @@ class WalletTest(BitcoinTestFramework):
for target, mode in product([-1, 0, 1009], ["economical", "conservative"]):
assert_raises_rpc_error(-8, "Invalid conf_target, must be between 1 and 1008", # max value of 1008 per src/policy/fees.h
self.nodes[2].sendmany, amounts={address: 1}, conf_target=target, estimate_mode=mode)
- for target, mode in product([-1, 0], ["btc/kb", "sat/b"]):
+ for target, mode in product([-1, 0], ["doge/kb", "koinu/b"]):
assert_raises_rpc_error(-8, 'Invalid estimate_mode parameter, must be one of: "unset", "economical", "conservative"',
self.nodes[2].sendmany, amounts={address: 1}, conf_target=target, estimate_mode=mode)
@@ -410,7 +410,7 @@ class WalletTest(BitcoinTestFramework):
self.nodes[0].generate(1)
self.sync_all(self.nodes[0:3])
- self.log.info("Test sendtoaddress with fee_rate param (explicit fee rate in sat/vB)")
+ self.log.info("Test sendtoaddress with fee_rate param (explicit fee rate in koinu/vB)")
prebalance = self.nodes[2].getbalance()
assert prebalance > 2
address = self.nodes[1].getnewaddress()
@@ -444,11 +444,11 @@ class WalletTest(BitcoinTestFramework):
# Test setting explicit fee rate just below the minimum.
self.log.info("Test sendtoaddress raises 'fee rate too low' if fee_rate of 0.99999999 is passed")
- assert_raises_rpc_error(-6, "Fee rate (0.999 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB)",
+ assert_raises_rpc_error(-6, "Fee rate (0.999 koinu/vB) is lower than the minimum fee rate setting (1.000 koinu/vB)",
self.nodes[2].sendtoaddress, address=address, amount=1, fee_rate=0.99999999)
self.log.info("Test sendtoaddress raises if fee_rate of 0 or -1 is passed")
- assert_raises_rpc_error(-6, "Fee rate (0.000 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB)",
+ assert_raises_rpc_error(-6, "Fee rate (0.000 koinu/vB) is lower than the minimum fee rate setting (1.000 koinu/vB)",
self.nodes[2].sendtoaddress, address=address, amount=10, fee_rate=0)
assert_raises_rpc_error(-3, OUT_OF_RANGE, self.nodes[2].sendtoaddress, address=address, amount=1.0, fee_rate=-1)
@@ -456,7 +456,7 @@ class WalletTest(BitcoinTestFramework):
for target, mode in product([-1, 0, 1009], ["economical", "conservative"]):
assert_raises_rpc_error(-8, "Invalid conf_target, must be between 1 and 1008", # max value of 1008 per src/policy/fees.h
self.nodes[2].sendtoaddress, address=address, amount=1, conf_target=target, estimate_mode=mode)
- for target, mode in product([-1, 0], ["btc/kb", "sat/b"]):
+ for target, mode in product([-1, 0], ["doge/kb", "koinu/b"]):
assert_raises_rpc_error(-8, 'Invalid estimate_mode parameter, must be one of: "unset", "economical", "conservative"',
self.nodes[2].sendtoaddress, address=address, amount=1, conf_target=target, estimate_mode=mode)
diff --git a/test/functional/wallet_bumpfee.py b/test/functional/wallet_bumpfee.py
index c8c1f2e37..9227d459c 100755
--- a/test/functional/wallet_bumpfee.py
+++ b/test/functional/wallet_bumpfee.py
@@ -135,7 +135,7 @@ class BumpFeeTest(BitcoinTestFramework):
for k, v in {"number": 42, "object": {"foo": "bar"}}.items():
assert_raises_rpc_error(-3, "Expected type string for estimate_mode, got {}".format(k),
rbf_node.bumpfee, rbfid, {"estimate_mode": v})
- for mode in ["foo", Decimal("3.1415"), "sat/B", "BTC/kB"]:
+ for mode in ["foo", Decimal("3.1415"), "koinu/B", "DOGE/kB"]:
assert_raises_rpc_error(-8, 'Invalid estimate_mode parameter, must be one of: "unset", "economical", "conservative"',
rbf_node.bumpfee, rbfid, {"estimate_mode": mode})
diff --git a/test/functional/wallet_multiwallet.py b/test/functional/wallet_multiwallet.py
index 0d715b313..1fe792b88 100755
--- a/test/functional/wallet_multiwallet.py
+++ b/test/functional/wallet_multiwallet.py
@@ -199,7 +199,7 @@ class MultiWalletTest(BitcoinTestFramework):
self.restart_node(0, ['-nowallet', '-walletdir=' + competing_wallet_dir])
self.nodes[0].createwallet(self.default_wallet_name)
if self.options.descriptors:
- exp_stderr = r"Error: SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another bitcoind?"
+ exp_stderr = r"Error: SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another dogecoind?"
else:
exp_stderr = r"Error: Error initializing wallet database environment \"\S+competing_walletdir\S*\"!"
self.nodes[1].assert_start_raises_init_error(['-walletdir=' + competing_wallet_dir], exp_stderr, match=ErrorMatch.PARTIAL_REGEX)
@@ -300,7 +300,7 @@ class MultiWalletTest(BitcoinTestFramework):
# Fail to load duplicate wallets
path = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets", "w1", "wallet.dat")
if self.options.descriptors:
- assert_raises_rpc_error(-4, "Wallet file verification failed. SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another bitcoind?", self.nodes[0].loadwallet, wallet_names[0])
+ assert_raises_rpc_error(-4, "Wallet file verification failed. SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another dogecoind?", self.nodes[0].loadwallet, wallet_names[0])
else:
assert_raises_rpc_error(-4, "Wallet file verification failed. Refusing to load database. Data file '{}' is already loaded.".format(path), self.nodes[0].loadwallet, wallet_names[0])
diff --git a/test/functional/wallet_send.py b/test/functional/wallet_send.py
index 9835c5a2a..ea9d63e0e 100755
--- a/test/functional/wallet_send.py
+++ b/test/functional/wallet_send.py
@@ -281,7 +281,7 @@ class WalletSendTest(BitcoinTestFramework):
self.test_send(from_wallet=w0, to_wallet=w1, amount=1, arg_fee_rate=1, fee_rate=1, add_to_wallet=False,
expect_error=(-8, "Pass the fee_rate either as an argument, or in the options object, but not both"))
- assert_raises_rpc_error(-8, "Use fee_rate (sat/vB) instead of feeRate", w0.send, {w1.getnewaddress(): 1}, 6, "conservative", 1, {"feeRate": 0.01})
+ assert_raises_rpc_error(-8, "Use fee_rate (koinu/vB) instead of feeRate", w0.send, {w1.getnewaddress(): 1}, 6, "conservative", 1, {"feeRate": 0.01})
assert_raises_rpc_error(-3, "Unexpected key totalFee", w0.send, {w1.getnewaddress(): 1}, 6, "conservative", 1, {"totalFee": 0.01})
@@ -289,14 +289,14 @@ class WalletSendTest(BitcoinTestFramework):
self.test_send(from_wallet=w0, to_wallet=w1, amount=1, conf_target=target, estimate_mode=mode,
expect_error=(-8, "Invalid conf_target, must be between 1 and 1008")) # max value of 1008 per src/policy/fees.h
msg = 'Invalid estimate_mode parameter, must be one of: "unset", "economical", "conservative"'
- for target, mode in product([-1, 0], ["btc/kb", "sat/b"]):
+ for target, mode in product([-1, 0], ["doge/kb", "koinu/b"]):
self.test_send(from_wallet=w0, to_wallet=w1, amount=1, conf_target=target, estimate_mode=mode, expect_error=(-8, msg))
for mode in ["", "foo", Decimal("3.141592")]:
self.test_send(from_wallet=w0, to_wallet=w1, amount=1, conf_target=0.1, estimate_mode=mode, expect_error=(-8, msg))
self.test_send(from_wallet=w0, to_wallet=w1, amount=1, arg_conf_target=0.1, arg_estimate_mode=mode, expect_error=(-8, msg))
assert_raises_rpc_error(-8, msg, w0.send, {w1.getnewaddress(): 1}, 0.1, mode)
- for mode in ["economical", "conservative", "btc/kb", "sat/b"]:
+ for mode in ["economical", "conservative", "doge/kb", "koinu/b"]:
self.log.debug("{}".format(mode))
for k, v in {"string": "true", "object": {"foo": "bar"}}.items():
self.test_send(from_wallet=w0, to_wallet=w1, amount=1, conf_target=v, estimate_mode=mode,
@@ -305,16 +305,16 @@ class WalletSendTest(BitcoinTestFramework):
# Test setting explicit fee rate just below the minimum and at zero.
self.log.info("Explicit fee rate raises RPC error 'fee rate too low' if fee_rate of 0.99999999 is passed")
self.test_send(from_wallet=w0, to_wallet=w1, amount=1, fee_rate=0.99999999,
- expect_error=(-4, "Fee rate (0.999 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB)"))
+ expect_error=(-4, "Fee rate (0.999 koinu/vB) is lower than the minimum fee rate setting (1.000 koinu/vB)"))
self.test_send(from_wallet=w0, to_wallet=w1, amount=1, arg_fee_rate=0.99999999,
- expect_error=(-4, "Fee rate (0.999 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB)"))
+ expect_error=(-4, "Fee rate (0.999 koinu/vB) is lower than the minimum fee rate setting (1.000 koinu/vB)"))
self.test_send(from_wallet=w0, to_wallet=w1, amount=1, fee_rate=0,
- expect_error=(-4, "Fee rate (0.000 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB)"))
+ expect_error=(-4, "Fee rate (0.000 koinu/vB) is lower than the minimum fee rate setting (1.000 koinu/vB)"))
self.test_send(from_wallet=w0, to_wallet=w1, amount=1, arg_fee_rate=0,
- expect_error=(-4, "Fee rate (0.000 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB)"))
+ expect_error=(-4, "Fee rate (0.000 koinu/vB) is lower than the minimum fee rate setting (1.000 koinu/vB)"))
# TODO: Return hex if fee rate is below -maxmempool
- # res = self.test_send(from_wallet=w0, to_wallet=w1, amount=1, conf_target=0.1, estimate_mode="sat/b", add_to_wallet=False)
+ # res = self.test_send(from_wallet=w0, to_wallet=w1, amount=1, conf_target=0.1, estimate_mode="koinu/b", add_to_wallet=False)
# assert res["hex"]
# hex = res["hex"]
# res = self.nodes[0].testmempoolaccept([hex])