mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-26 17:52:13 +01:00
test: drop testnet3 coverage
Except for the deprecation warning. This test now writes its own config file, which was previously done by test_acceptstalefeeestimates_arg_support. This code will be removed once -testnet3 is dropped.
This commit is contained in:
parent
6539ae7af4
commit
c44b31ed61
@ -643,10 +643,9 @@ BOOST_AUTO_TEST_CASE(util_GetArg)
|
||||
BOOST_AUTO_TEST_CASE(util_GetChainTypeString)
|
||||
{
|
||||
TestArgsManager test_args;
|
||||
const auto testnet = std::make_pair("-testnet", ArgsManager::ALLOW_ANY);
|
||||
const auto testnet4 = std::make_pair("-testnet4", ArgsManager::ALLOW_ANY);
|
||||
const auto regtest = std::make_pair("-regtest", ArgsManager::ALLOW_ANY);
|
||||
test_args.SetupArgs({testnet, testnet4, regtest});
|
||||
test_args.SetupArgs({testnet4, regtest});
|
||||
|
||||
const char* argv_testnet4[] = {"cmd", "-testnet4"};
|
||||
const char* argv_regtest[] = {"cmd", "-regtest"};
|
||||
@ -764,8 +763,8 @@ struct ArgsMergeTestingSetup : public BasicTestingSetup {
|
||||
ForEachNoDup(conf_actions, SET, SECTION_NEGATE, [&] {
|
||||
for (bool soft_set : {false, true}) {
|
||||
for (bool force_set : {false, true}) {
|
||||
for (const std::string& section : {ChainTypeToString(ChainType::MAIN), ChainTypeToString(ChainType::TESTNET), ChainTypeToString(ChainType::TESTNET4), ChainTypeToString(ChainType::SIGNET)}) {
|
||||
for (const std::string& network : {ChainTypeToString(ChainType::MAIN), ChainTypeToString(ChainType::TESTNET), ChainTypeToString(ChainType::TESTNET4), ChainTypeToString(ChainType::SIGNET)}) {
|
||||
for (const std::string& section : {ChainTypeToString(ChainType::MAIN), ChainTypeToString(ChainType::TESTNET4), ChainTypeToString(ChainType::SIGNET)}) {
|
||||
for (const std::string& network : {ChainTypeToString(ChainType::MAIN), ChainTypeToString(ChainType::TESTNET4), ChainTypeToString(ChainType::SIGNET)}) {
|
||||
for (bool net_specific : {false, true}) {
|
||||
fn(arg_actions, conf_actions, soft_set, force_set, section, network, net_specific);
|
||||
}
|
||||
@ -919,7 +918,7 @@ BOOST_FIXTURE_TEST_CASE(util_ArgsMerge, ArgsMergeTestingSetup)
|
||||
// Results file is formatted like:
|
||||
//
|
||||
// <input> || <IsArgSet/IsArgNegated/GetArg output> | <GetArgs output> | <GetUnsuitable output>
|
||||
BOOST_CHECK_EQUAL(out_sha_hex, "f1ee5ab094cc43d16a6086fa7f2c10389e0f99902616b31bbf29189972ad1473");
|
||||
BOOST_CHECK_EQUAL(out_sha_hex, "4255a9ad78d2a68341750bf2de61131ef5610808b6e37b6f546222ca7342f36a");
|
||||
}
|
||||
|
||||
// Similar test as above, but for ArgsManager::GetChainTypeString function.
|
||||
|
@ -137,7 +137,7 @@ BOOST_AUTO_TEST_CASE(key_io_invalid)
|
||||
std::string exp_base58string = test[0].get_str();
|
||||
|
||||
// must be invalid as public and as private key
|
||||
for (const auto& chain : {ChainType::MAIN, ChainType::TESTNET, ChainType::SIGNET, ChainType::REGTEST}) {
|
||||
for (const auto& chain : {ChainType::MAIN, ChainType::SIGNET, ChainType::REGTEST}) {
|
||||
SelectParams(chain);
|
||||
destination = DecodeDestination(exp_base58string);
|
||||
BOOST_CHECK_MESSAGE(!IsValidDestination(destination), "IsValid pubkey in mainnet:" + strTest);
|
||||
|
@ -193,11 +193,6 @@ BOOST_AUTO_TEST_CASE(ChainParams_REGTEST_sanity)
|
||||
sanity_check_chainparams(*m_node.args, ChainType::REGTEST);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ChainParams_TESTNET_sanity)
|
||||
{
|
||||
sanity_check_chainparams(*m_node.args, ChainType::TESTNET);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ChainParams_TESTNET4_sanity)
|
||||
{
|
||||
sanity_check_chainparams(*m_node.args, ChainType::TESTNET4);
|
||||
|
@ -424,7 +424,7 @@ BOOST_FIXTURE_TEST_CASE(versionbits_computeblockversion, BlockVersionTest)
|
||||
|
||||
// check that any deployment on any chain can conceivably reach both
|
||||
// ACTIVE and FAILED states in roughly the way we expect
|
||||
for (const auto& chain_type: {ChainType::MAIN, ChainType::TESTNET, ChainType::TESTNET4, ChainType::SIGNET, ChainType::REGTEST}) {
|
||||
for (const auto& chain_type: {ChainType::MAIN, ChainType::TESTNET4, ChainType::SIGNET, ChainType::REGTEST}) {
|
||||
const auto chainParams = CreateChainParams(*m_node.args, chain_type);
|
||||
uint32_t chain_all_vbits{0};
|
||||
for (int i = 0; i < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++i) {
|
||||
|
@ -102,7 +102,6 @@ class AssumeutxoTest(BitcoinTestFramework):
|
||||
invalid_magics = [
|
||||
# magic, name, real
|
||||
[0xf9beb4d9, "main", True],
|
||||
[0x0b110907, "test", True],
|
||||
[0x0a03cf40, "signet", True],
|
||||
[0x00000000, "", False],
|
||||
[0xffffffff, "", False],
|
||||
|
@ -462,7 +462,7 @@ class ConfArgsTest(BitcoinTestFramework):
|
||||
def test_acceptstalefeeestimates_arg_support(self):
|
||||
self.log.info("Test -acceptstalefeeestimates option support")
|
||||
conf_file = self.nodes[0].datadir_path / "bitcoin.conf"
|
||||
for chain, chain_name in {("main", ""), ("test", "testnet3"), ("signet", "signet"), ("testnet4", "testnet4")}:
|
||||
for chain, chain_name in {("main", ""), ("signet", "signet"), ("testnet4", "testnet4")}:
|
||||
util.write_config(conf_file, n=0, chain=chain_name, extra_config='acceptstalefeeestimates=1\n')
|
||||
self.nodes[0].assert_start_raises_init_error(expected_msg=f'Error: acceptstalefeeestimates is not supported on {chain} chain.')
|
||||
util.write_config(conf_file, n=0, chain="regtest") # Reset to regtest
|
||||
@ -476,6 +476,11 @@ class ConfArgsTest(BitcoinTestFramework):
|
||||
|
||||
# Testnet3 node will log the warning
|
||||
self.nodes[0].chain = 'testnet3'
|
||||
# Ensure a log file exists as TestNode.assert_debug_log() expects it.
|
||||
self.nodes[0].debug_log_path.parent.mkdir()
|
||||
self.nodes[0].debug_log_path.touch()
|
||||
util.write_config(self.nodes[0].datadir_path / "bitcoin.conf", n=0, chain="testnet3")
|
||||
|
||||
self.nodes[0].replace_in_config([('regtest=', 'testnet='), ('[regtest]', '[test]')])
|
||||
with self.nodes[0].assert_debug_log([t3_warning_log]):
|
||||
self.start_node(0)
|
||||
|
@ -20,10 +20,7 @@ class WalletCrossChain(BitcoinTestFramework):
|
||||
def setup_network(self):
|
||||
self.add_nodes(self.num_nodes)
|
||||
|
||||
# Switch node 1 to testnet before starting it.
|
||||
self.nodes[1].chain = 'testnet3'
|
||||
self.nodes[1].extra_args = ['-maxconnections=0', '-prune=550'] # disable testnet sync
|
||||
self.nodes[1].replace_in_config([('regtest=', 'testnet='), ('[regtest]', '[test]')])
|
||||
# Node 1 is omitted, it was previously used with testnet3.
|
||||
|
||||
# Switch node 2 to testnet4 before starting it.
|
||||
self.nodes[2].chain = 'testnet4'
|
||||
@ -40,11 +37,7 @@ class WalletCrossChain(BitcoinTestFramework):
|
||||
self.nodes[0].createwallet(node0_wallet)
|
||||
self.nodes[0].backupwallet(node0_wallet_backup)
|
||||
self.nodes[0].unloadwallet(node0_wallet)
|
||||
node1_wallet = self.nodes[1].datadir_path / 'node1_wallet'
|
||||
node1_wallet_backup = self.nodes[0].datadir_path / 'node1_wallet.bak'
|
||||
self.nodes[1].createwallet(node1_wallet)
|
||||
self.nodes[1].backupwallet(node1_wallet_backup)
|
||||
self.nodes[1].unloadwallet(node1_wallet)
|
||||
|
||||
node2_wallet = self.nodes[2].datadir_path / 'node2_wallet'
|
||||
node2_wallet_backup = self.nodes[0].datadir_path / 'node2_wallet.bak'
|
||||
self.nodes[2].createwallet(node2_wallet)
|
||||
@ -54,38 +47,22 @@ class WalletCrossChain(BitcoinTestFramework):
|
||||
self.log.info("Loading/restoring wallets into nodes with a different genesis block")
|
||||
|
||||
if self.options.descriptors:
|
||||
assert_raises_rpc_error(-18, 'Wallet file verification failed.', self.nodes[0].loadwallet, node1_wallet)
|
||||
assert_raises_rpc_error(-18, 'Wallet file verification failed.', self.nodes[0].loadwallet, node2_wallet)
|
||||
assert_raises_rpc_error(-18, 'Wallet file verification failed.', self.nodes[1].loadwallet, node0_wallet)
|
||||
assert_raises_rpc_error(-18, 'Wallet file verification failed.', self.nodes[2].loadwallet, node0_wallet)
|
||||
assert_raises_rpc_error(-18, 'Wallet file verification failed.', self.nodes[1].loadwallet, node2_wallet)
|
||||
assert_raises_rpc_error(-18, 'Wallet file verification failed.', self.nodes[2].loadwallet, node1_wallet)
|
||||
assert_raises_rpc_error(-18, 'Wallet file verification failed.', self.nodes[0].restorewallet, 'w', node1_wallet_backup)
|
||||
assert_raises_rpc_error(-18, 'Wallet file verification failed.', self.nodes[0].restorewallet, 'w', node2_wallet_backup)
|
||||
assert_raises_rpc_error(-18, 'Wallet file verification failed.', self.nodes[1].restorewallet, 'w', node0_wallet_backup)
|
||||
assert_raises_rpc_error(-18, 'Wallet file verification failed.', self.nodes[2].restorewallet, 'w', node0_wallet_backup)
|
||||
assert_raises_rpc_error(-18, 'Wallet file verification failed.', self.nodes[1].restorewallet, 'w', node2_wallet_backup)
|
||||
assert_raises_rpc_error(-18, 'Wallet file verification failed.', self.nodes[2].restorewallet, 'w', node1_wallet_backup)
|
||||
else:
|
||||
assert_raises_rpc_error(-4, 'Wallet files should not be reused across chains.', self.nodes[0].loadwallet, node1_wallet)
|
||||
assert_raises_rpc_error(-4, 'Wallet files should not be reused across chains.', self.nodes[0].loadwallet, node2_wallet)
|
||||
assert_raises_rpc_error(-4, 'Wallet files should not be reused across chains.', self.nodes[1].loadwallet, node0_wallet)
|
||||
assert_raises_rpc_error(-4, 'Wallet files should not be reused across chains.', self.nodes[2].loadwallet, node0_wallet)
|
||||
assert_raises_rpc_error(-4, 'Wallet files should not be reused across chains.', self.nodes[1].loadwallet, node2_wallet)
|
||||
assert_raises_rpc_error(-4, 'Wallet files should not be reused across chains.', self.nodes[2].loadwallet, node1_wallet)
|
||||
assert_raises_rpc_error(-4, 'Wallet files should not be reused across chains.', self.nodes[0].restorewallet, 'w', node1_wallet_backup)
|
||||
assert_raises_rpc_error(-4, 'Wallet files should not be reused across chains.', self.nodes[0].restorewallet, 'w', node2_wallet_backup)
|
||||
assert_raises_rpc_error(-4, 'Wallet files should not be reused across chains.', self.nodes[1].restorewallet, 'w', node0_wallet_backup)
|
||||
assert_raises_rpc_error(-4, 'Wallet files should not be reused across chains.', self.nodes[2].restorewallet, 'w', node0_wallet_backup)
|
||||
assert_raises_rpc_error(-4, 'Wallet files should not be reused across chains.', self.nodes[1].restorewallet, 'w', node2_wallet_backup)
|
||||
assert_raises_rpc_error(-4, 'Wallet files should not be reused across chains.', self.nodes[2].restorewallet, 'w', node1_wallet_backup)
|
||||
|
||||
if not self.options.descriptors:
|
||||
self.log.info("Override cross-chain wallet load protection")
|
||||
self.stop_nodes()
|
||||
self.start_nodes([['-walletcrosschain', '-prune=550']] * self.num_nodes)
|
||||
self.nodes[0].loadwallet(node1_wallet)
|
||||
self.nodes[1].loadwallet(node0_wallet)
|
||||
self.nodes[0].loadwallet(node2_wallet)
|
||||
self.nodes[2].loadwallet(node0_wallet)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
x
Reference in New Issue
Block a user