mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
Merge #15891: test: Require standard txs in regtest by default
fa89badf887dcc01e5bdece248b5e7d234fee227 test: Require standard txs in regtest (MarcoFalke) fa9b4191609c3ef75e69d391eb91e4d5c1e0bcf5 test: Add test that mainnet requires standard txs (MarcoFalke) fa613ca0a8f99c4771859de9e571878530d3ecb5 chainparams: Remove unused fMineBlocksOnDemand (MarcoFalke) Pull request description: I don't see a reason why regtest should allow non-standard txs, as it makes testing mainnet behaviour such as #15846 unnecessarily hard and unintuitive. Of course, testnet policy remains unchanged to allow propagation of non-standard txs. ACKs for top commit: ajtowns: ACK fa89badf887dcc01e5bdece248b5e7d234fee227 Tree-SHA512: c4c675affb054868850bd2683aa07f4c741a448cbacb2ea8334191e105f426b0790fe6a468be61e9c5880d24154f7bf1c7075051697172dce92180c1bc3a1c90
This commit is contained in:
parent
41f9bfaee6
commit
8ca90f3f99
@ -309,7 +309,7 @@ public:
|
|||||||
fDefaultConsistencyChecks = false;
|
fDefaultConsistencyChecks = false;
|
||||||
fRequireStandard = true;
|
fRequireStandard = true;
|
||||||
fRequireRoutableExternalIP = true;
|
fRequireRoutableExternalIP = true;
|
||||||
fMineBlocksOnDemand = false;
|
m_is_test_chain = false;
|
||||||
fAllowMultipleAddressesFromGroup = false;
|
fAllowMultipleAddressesFromGroup = false;
|
||||||
fAllowMultiplePorts = false;
|
fAllowMultiplePorts = false;
|
||||||
nLLMQConnectionRetryTimeout = 60;
|
nLLMQConnectionRetryTimeout = 60;
|
||||||
@ -525,7 +525,7 @@ public:
|
|||||||
fDefaultConsistencyChecks = false;
|
fDefaultConsistencyChecks = false;
|
||||||
fRequireStandard = false;
|
fRequireStandard = false;
|
||||||
fRequireRoutableExternalIP = true;
|
fRequireRoutableExternalIP = true;
|
||||||
fMineBlocksOnDemand = false;
|
m_is_test_chain = true;
|
||||||
fAllowMultipleAddressesFromGroup = false;
|
fAllowMultipleAddressesFromGroup = false;
|
||||||
fAllowMultiplePorts = true;
|
fAllowMultiplePorts = true;
|
||||||
nLLMQConnectionRetryTimeout = 60;
|
nLLMQConnectionRetryTimeout = 60;
|
||||||
@ -726,7 +726,7 @@ public:
|
|||||||
fDefaultConsistencyChecks = false;
|
fDefaultConsistencyChecks = false;
|
||||||
fRequireStandard = false;
|
fRequireStandard = false;
|
||||||
fRequireRoutableExternalIP = true;
|
fRequireRoutableExternalIP = true;
|
||||||
fMineBlocksOnDemand = false;
|
m_is_test_chain = true;
|
||||||
fAllowMultipleAddressesFromGroup = true;
|
fAllowMultipleAddressesFromGroup = true;
|
||||||
fAllowMultiplePorts = true;
|
fAllowMultiplePorts = true;
|
||||||
nLLMQConnectionRetryTimeout = 60;
|
nLLMQConnectionRetryTimeout = 60;
|
||||||
@ -908,9 +908,9 @@ public:
|
|||||||
vSeeds.clear(); //!< Regtest mode doesn't have any DNS seeds.
|
vSeeds.clear(); //!< Regtest mode doesn't have any DNS seeds.
|
||||||
|
|
||||||
fDefaultConsistencyChecks = true;
|
fDefaultConsistencyChecks = true;
|
||||||
fRequireStandard = false;
|
fRequireStandard = true;
|
||||||
fRequireRoutableExternalIP = false;
|
fRequireRoutableExternalIP = false;
|
||||||
fMineBlocksOnDemand = true;
|
m_is_test_chain = true;
|
||||||
fAllowMultipleAddressesFromGroup = true;
|
fAllowMultipleAddressesFromGroup = true;
|
||||||
fAllowMultiplePorts = true;
|
fAllowMultiplePorts = true;
|
||||||
nLLMQConnectionRetryTimeout = 1; // must be lower then the LLMQ signing session timeout so that tests have control over failing behavior
|
nLLMQConnectionRetryTimeout = 1; // must be lower then the LLMQ signing session timeout so that tests have control over failing behavior
|
||||||
|
@ -70,13 +70,15 @@ public:
|
|||||||
bool RequireStandard() const { return fRequireStandard; }
|
bool RequireStandard() const { return fRequireStandard; }
|
||||||
/** Require addresses specified with "-externalip" parameter to be routable */
|
/** Require addresses specified with "-externalip" parameter to be routable */
|
||||||
bool RequireRoutableExternalIP() const { return fRequireRoutableExternalIP; }
|
bool RequireRoutableExternalIP() const { return fRequireRoutableExternalIP; }
|
||||||
|
/** If this is a test chain */
|
||||||
|
bool IsTestChain() const { return m_is_test_chain; }
|
||||||
uint64_t PruneAfterHeight() const { return nPruneAfterHeight; }
|
uint64_t PruneAfterHeight() const { return nPruneAfterHeight; }
|
||||||
/** Minimum free space (in GB) needed for data directory */
|
/** Minimum free space (in GB) needed for data directory */
|
||||||
uint64_t AssumedBlockchainSize() const { return m_assumed_blockchain_size; }
|
uint64_t AssumedBlockchainSize() const { return m_assumed_blockchain_size; }
|
||||||
/** Minimum free space (in GB) needed for data directory when pruned; Does not include prune target*/
|
/** Minimum free space (in GB) needed for data directory when pruned; Does not include prune target*/
|
||||||
uint64_t AssumedChainStateSize() const { return m_assumed_chain_state_size; }
|
uint64_t AssumedChainStateSize() const { return m_assumed_chain_state_size; }
|
||||||
/** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */
|
/** Whether it is possible to mine blocks on demand (no retargeting) */
|
||||||
bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
|
bool MineBlocksOnDemand() const { return consensus.fPowNoRetargeting; }
|
||||||
/** Allow multiple addresses to be selected from the same network group (e.g. 192.168.x.x) */
|
/** Allow multiple addresses to be selected from the same network group (e.g. 192.168.x.x) */
|
||||||
bool AllowMultipleAddressesFromGroup() const { return fAllowMultipleAddressesFromGroup; }
|
bool AllowMultipleAddressesFromGroup() const { return fAllowMultipleAddressesFromGroup; }
|
||||||
/** Allow nodes with the same address and multiple ports */
|
/** Allow nodes with the same address and multiple ports */
|
||||||
@ -130,7 +132,7 @@ protected:
|
|||||||
bool fDefaultConsistencyChecks;
|
bool fDefaultConsistencyChecks;
|
||||||
bool fRequireStandard;
|
bool fRequireStandard;
|
||||||
bool fRequireRoutableExternalIP;
|
bool fRequireRoutableExternalIP;
|
||||||
bool fMineBlocksOnDemand;
|
bool m_is_test_chain;
|
||||||
bool fAllowMultipleAddressesFromGroup;
|
bool fAllowMultipleAddressesFromGroup;
|
||||||
bool fAllowMultiplePorts;
|
bool fAllowMultiplePorts;
|
||||||
int nLLMQConnectionRetryTimeout;
|
int nLLMQConnectionRetryTimeout;
|
||||||
|
@ -1494,8 +1494,9 @@ bool AppInitParameterInteraction()
|
|||||||
}
|
}
|
||||||
|
|
||||||
fRequireStandard = !gArgs.GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard());
|
fRequireStandard = !gArgs.GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard());
|
||||||
if (chainparams.RequireStandard() && !fRequireStandard)
|
if (!chainparams.IsTestChain() && !fRequireStandard) {
|
||||||
return InitError(strprintf("acceptnonstdtxn is not currently supported for %s chain", chainparams.NetworkIDString()));
|
return InitError(strprintf("acceptnonstdtxn is not currently supported for %s chain", chainparams.NetworkIDString()));
|
||||||
|
}
|
||||||
nBytesPerSigOp = gArgs.GetArg("-bytespersigop", nBytesPerSigOp);
|
nBytesPerSigOp = gArgs.GetArg("-bytespersigop", nBytesPerSigOp);
|
||||||
|
|
||||||
if (!g_wallet_init_interface.ParameterInteraction()) return false;
|
if (!g_wallet_init_interface.ParameterInteraction()) return false;
|
||||||
|
@ -21,7 +21,10 @@ NOT_FINAL_ERROR = "non-BIP68-final (code 64)"
|
|||||||
class BIP68Test(BitcoinTestFramework):
|
class BIP68Test(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.extra_args = [[], ["-acceptnonstdtxn=0"]]
|
self.extra_args = [
|
||||||
|
["-acceptnonstdtxn=1"],
|
||||||
|
["-acceptnonstdtxn=0"],
|
||||||
|
]
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
@ -82,7 +82,7 @@ class FullBlockTest(BitcoinTestFramework):
|
|||||||
# which causes RPC to hang, so we need to increase RPC timeouts
|
# which causes RPC to hang, so we need to increase RPC timeouts
|
||||||
self.rpc_timeout = 180
|
self.rpc_timeout = 180
|
||||||
# Must set '-dip3params=2000:2000' to create pre-dip3 blocks only
|
# Must set '-dip3params=2000:2000' to create pre-dip3 blocks only
|
||||||
self.extra_args = [['-dip3params=2000:2000']]
|
self.extra_args = [['-dip3params=2000:2000', '-acceptnonstdtxn=1']] # This is a consensus block test, we don't care about tx policy
|
||||||
|
|
||||||
def setup_nodes(self):
|
def setup_nodes(self):
|
||||||
self.add_nodes(self.num_nodes, self.extra_args)
|
self.add_nodes(self.num_nodes, self.extra_args)
|
||||||
|
@ -59,7 +59,12 @@ def cltv_validate(node, tx, height):
|
|||||||
class BIP65Test(BitcoinTestFramework):
|
class BIP65Test(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
self.extra_args = [['-whitelist=127.0.0.1', '-dip3params=9000:9000', '-par=1']] # Use only one script thread to get the exact reject reason for testing
|
self.extra_args = [[
|
||||||
|
'-whitelist=127.0.0.1',
|
||||||
|
'-dip3params=9000:9000',
|
||||||
|
'-par=1', # Use only one script thread to get the exact reject reason for testing
|
||||||
|
'-acceptnonstdtxn=1', # cltv_invalidate is nonstandard
|
||||||
|
]]
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.rpc_timeout = 120
|
self.rpc_timeout = 120
|
||||||
|
|
||||||
|
@ -40,6 +40,11 @@ class ConfArgsTest(BitcoinTestFramework):
|
|||||||
conf.write("wallet=foo\n")
|
conf.write("wallet=foo\n")
|
||||||
self.nodes[0].assert_start_raises_init_error(expected_msg='Error: Config setting for -wallet only applied on regtest network when in [regtest] section.')
|
self.nodes[0].assert_start_raises_init_error(expected_msg='Error: Config setting for -wallet only applied on regtest network when in [regtest] section.')
|
||||||
|
|
||||||
|
with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
|
||||||
|
conf.write('regtest=0\n') # mainnet
|
||||||
|
conf.write('acceptnonstdtxn=1\n')
|
||||||
|
self.nodes[0].assert_start_raises_init_error(expected_msg='Error: acceptnonstdtxn is not currently supported for main chain')
|
||||||
|
|
||||||
with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
|
with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
|
||||||
conf.write('nono\n')
|
conf.write('nono\n')
|
||||||
self.nodes[0].assert_start_raises_init_error(expected_msg='Error reading configuration file: parse error on line 1: nono, if you intended to specify a negated option, use nono=1 instead')
|
self.nodes[0].assert_start_raises_init_error(expected_msg='Error reading configuration file: parse error on line 1: nono, if you intended to specify a negated option, use nono=1 instead')
|
||||||
|
@ -19,6 +19,7 @@ DISABLED_OPCODE_ERROR = "non-mandatory-script-verify-flag (Attempted to use a di
|
|||||||
class DIP0020ActivationTest(BitcoinTestFramework):
|
class DIP0020ActivationTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
self.extra_args = [["-acceptnonstdtxn=1"]]
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
@ -31,7 +32,7 @@ class DIP0020ActivationTest(BitcoinTestFramework):
|
|||||||
utxos = self.node.listunspent()
|
utxos = self.node.listunspent()
|
||||||
assert len(utxos) > 0
|
assert len(utxos) > 0
|
||||||
|
|
||||||
# Send some coins to a P2SH address constructed using disabled opcodes
|
# Lock some coins using disabled opcodes
|
||||||
utxo = utxos[len(utxos) - 1]
|
utxo = utxos[len(utxos) - 1]
|
||||||
value = int(satoshi_round(utxo["amount"] - self.relayfee) * COIN)
|
value = int(satoshi_round(utxo["amount"] - self.relayfee) * COIN)
|
||||||
tx = CTransaction()
|
tx = CTransaction()
|
||||||
|
@ -126,9 +126,9 @@ class EstimateFeeTest(BitcoinTestFramework):
|
|||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
# mine non-standard txs (e.g. txs with "dust" outputs)
|
# mine non-standard txs (e.g. txs with "dust" outputs)
|
||||||
self.extra_args = [
|
self.extra_args = [
|
||||||
["-maxorphantxsize=1000", "-whitelist=127.0.0.1"],
|
["-acceptnonstdtxn=1", "-maxorphantxsize=1000", "-whitelist=127.0.0.1"],
|
||||||
["-blockmaxsize=17000", "-maxorphantxsize=1000", "-whitelist=127.0.0.1"],
|
["-acceptnonstdtxn=1", "-blockmaxsize=17000", "-maxorphantxsize=1000", "-whitelist=127.0.0.1"],
|
||||||
["-blockmaxsize=8000", "-maxorphantxsize=1000", "-whitelist=127.0.0.1"]
|
["-acceptnonstdtxn=1", "-blockmaxsize=8000", "-maxorphantxsize=1000", "-whitelist=127.0.0.1"]
|
||||||
]
|
]
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
|
@ -35,7 +35,7 @@ class MaxUploadTest(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
|
||||||
self.extra_args = [["-maxuploadtarget=200", "-blockmaxsize=999000", "-maxtipage="+str(2*60*60*24*7)]]
|
self.extra_args = [["-maxuploadtarget=200", "-blockmaxsize=999000", "-maxtipage="+str(2*60*60*24*7), "-acceptnonstdtxn=1"]]
|
||||||
|
|
||||||
# Cache for utxos, as the listunspent may take a long time later in the test
|
# Cache for utxos, as the listunspent may take a long time later in the test
|
||||||
self.utxo_cache = []
|
self.utxo_cache = []
|
||||||
|
@ -38,7 +38,6 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
|||||||
self.extra_args = [[
|
self.extra_args = [[
|
||||||
'-txindex',
|
'-txindex',
|
||||||
'-reindex', # Need reindex for txindex
|
'-reindex', # Need reindex for txindex
|
||||||
'-acceptnonstdtxn=0', # Try to mimic main-net
|
|
||||||
]] * self.num_nodes
|
]] * self.num_nodes
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
|
@ -13,7 +13,11 @@ class MempoolLimitTest(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
|
||||||
self.extra_args = [["-maxmempool=5", "-spendzeroconfchange=0"]]
|
self.extra_args = [[
|
||||||
|
"-acceptnonstdtxn=1",
|
||||||
|
"-maxmempool=5",
|
||||||
|
"-spendzeroconfchange=0",
|
||||||
|
]]
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
@ -12,7 +12,10 @@ class PrioritiseTransactionTest(BitcoinTestFramework):
|
|||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.extra_args = [["-printpriority=1"]] * 2
|
self.extra_args = [[
|
||||||
|
"-printpriority=1",
|
||||||
|
"-acceptnonstdtxn=1",
|
||||||
|
]] * self.num_nodes
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
@ -93,7 +93,10 @@ class CompactBlocksTest(BitcoinTestFramework):
|
|||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
# both nodes has the same version
|
# both nodes has the same version
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.extra_args = [["-txindex"]] * 2
|
self.extra_args = [[
|
||||||
|
"-txindex",
|
||||||
|
"-acceptnonstdtxn=1",
|
||||||
|
]] * 2
|
||||||
self.utxos = []
|
self.utxos = []
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
|
@ -27,6 +27,9 @@ class InvalidTxRequestTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
self.extra_args = [[
|
||||||
|
"-acceptnonstdtxn=1",
|
||||||
|
]]
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
|
|
||||||
def bootstrap_p2p(self, *, num_connections=1):
|
def bootstrap_p2p(self, *, num_connections=1):
|
||||||
@ -100,7 +103,7 @@ class InvalidTxRequestTest(BitcoinTestFramework):
|
|||||||
self.test_orphan_tx_handling(block1.vtx[0].sha256, False)
|
self.test_orphan_tx_handling(block1.vtx[0].sha256, False)
|
||||||
|
|
||||||
self.log.info('Test orphan transaction handling, resolve via block')
|
self.log.info('Test orphan transaction handling, resolve via block')
|
||||||
self.restart_node(0, ['-persistmempool=0'])
|
self.restart_node(0, ["-acceptnonstdtxn=1", '-persistmempool=0'])
|
||||||
self.reconnect_p2p(num_connections=2)
|
self.reconnect_p2p(num_connections=2)
|
||||||
self.test_orphan_tx_handling(block2.vtx[0].sha256, True)
|
self.test_orphan_tx_handling(block2.vtx[0].sha256, True)
|
||||||
|
|
||||||
|
@ -21,8 +21,11 @@ from test_framework.util import (
|
|||||||
class WalletTest(BitcoinTestFramework):
|
class WalletTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 4
|
self.num_nodes = 4
|
||||||
|
self.extra_args = [[
|
||||||
|
"-acceptnonstdtxn=1",
|
||||||
|
'-usehd={:d}'.format(i%2==0),
|
||||||
|
] for i in range(self.num_nodes)]
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.extra_args = [['-usehd={:d}'.format(i%2==0)] for i in range(4)]
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
Loading…
Reference in New Issue
Block a user