mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
fix: push activation height for forks ahead, fix feature_pruning.py
We need to push DIP-0001's activation height ahead as post-DIP-0001 consensus rejects transactions greater than `MAX_STANDARD_TX_SIZE` (`bad-txns-oversize`) and this test generates transactions nearly 9.5x that. We also need to push v20 activation ahead to avoid different subsidy calculation logic (`bad-cb-amount`).
This commit is contained in:
parent
10203560f5
commit
bcd24a25e3
@ -33,6 +33,13 @@ from test_framework.util import (
|
|||||||
# compatible with pruning based on key creation time.
|
# compatible with pruning based on key creation time.
|
||||||
TIMESTAMP_WINDOW = 2 * 60 * 60
|
TIMESTAMP_WINDOW = 2 * 60 * 60
|
||||||
|
|
||||||
|
DEPLOYMENT_ARGS = [
|
||||||
|
"-dip3params=2000:2000",
|
||||||
|
"-testactivationheight=dip0001@2000",
|
||||||
|
"-testactivationheight=dip0008@2000",
|
||||||
|
"-testactivationheight=v20@2000",
|
||||||
|
]
|
||||||
|
|
||||||
def mine_large_blocks(node, n):
|
def mine_large_blocks(node, n):
|
||||||
# Make a large scriptPubKey for the coinbase transaction. This is OP_RETURN
|
# Make a large scriptPubKey for the coinbase transaction. This is OP_RETURN
|
||||||
# followed by 950k of OP_NOP. This would be non-standard in a non-coinbase
|
# followed by 950k of OP_NOP. This would be non-standard in a non-coinbase
|
||||||
@ -87,16 +94,16 @@ class PruneTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
# Create nodes 0 and 1 to mine.
|
# Create nodes 0 and 1 to mine.
|
||||||
# Create node 2 to test pruning.
|
# Create node 2 to test pruning.
|
||||||
self.full_node_default_args = ["-dip3params=2000:2000", "-testactivationheight=dip0008@2000", "-maxreceivebuffer=20000", "-blockmaxsize=999000", "-checkblocks=5"]
|
self.full_node_default_args = ["-maxreceivebuffer=20000", "-blockmaxsize=999000", "-checkblocks=5"] + DEPLOYMENT_ARGS
|
||||||
# Create nodes 3 and 4 to test manual pruning (they will be re-started with manual pruning later)
|
# Create nodes 3 and 4 to test manual pruning (they will be re-started with manual pruning later)
|
||||||
# Create nodes 5 to test wallet in prune mode, but do not connect
|
# Create nodes 5 to test wallet in prune mode, but do not connect
|
||||||
self.extra_args = [
|
self.extra_args = [
|
||||||
self.full_node_default_args,
|
self.full_node_default_args,
|
||||||
self.full_node_default_args,
|
self.full_node_default_args,
|
||||||
["-dip3params=2000:2000", "-testactivationheight=dip0008@2000", "-disablegovernance","-txindex=0","-maxreceivebuffer=20000","-prune=550"],
|
["-disablegovernance","-txindex=0","-maxreceivebuffer=20000","-prune=550"] + DEPLOYMENT_ARGS,
|
||||||
["-dip3params=2000:2000", "-testactivationheight=dip0008@2000", "-disablegovernance","-txindex=0","-maxreceivebuffer=20000","-blockmaxsize=999000"],
|
["-disablegovernance","-txindex=0","-maxreceivebuffer=20000","-blockmaxsize=999000"] + DEPLOYMENT_ARGS,
|
||||||
["-dip3params=2000:2000", "-testactivationheight=dip0008@2000", "-disablegovernance","-txindex=0","-maxreceivebuffer=20000","-blockmaxsize=999000"],
|
["-disablegovernance","-txindex=0","-maxreceivebuffer=20000","-blockmaxsize=999000"] + DEPLOYMENT_ARGS,
|
||||||
["-dip3params=2000:2000", "-testactivationheight=dip0008@2000", "-disablegovernance","-txindex=0","-prune=550"],
|
["-disablegovernance","-txindex=0","-prune=550"] + DEPLOYMENT_ARGS,
|
||||||
]
|
]
|
||||||
self.rpc_timeout = 120
|
self.rpc_timeout = 120
|
||||||
|
|
||||||
@ -213,7 +220,7 @@ class PruneTest(BitcoinTestFramework):
|
|||||||
self.log.info("New best height: %d" % self.nodes[1].getblockcount())
|
self.log.info("New best height: %d" % self.nodes[1].getblockcount())
|
||||||
|
|
||||||
# Mine one block to avoid automatic recovery from forks on restart
|
# Mine one block to avoid automatic recovery from forks on restart
|
||||||
self.generate(self.nodes[1], 1)
|
self.generate(self.nodes[1], 1, sync_fun=self.no_op)
|
||||||
# Disconnect node1 and generate the new chain
|
# Disconnect node1 and generate the new chain
|
||||||
self.disconnect_nodes(0, 1)
|
self.disconnect_nodes(0, 1)
|
||||||
self.disconnect_nodes(1, 2)
|
self.disconnect_nodes(1, 2)
|
||||||
@ -283,13 +290,13 @@ class PruneTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
def manual_test(self, node_number, use_timestamp):
|
def manual_test(self, node_number, use_timestamp):
|
||||||
# at this point, node has 995 blocks and has not yet run in prune mode
|
# at this point, node has 995 blocks and has not yet run in prune mode
|
||||||
self.start_node(node_number, extra_args=["-dip3params=2000:2000", "-testactivationheight=dip0008@2000", "-disablegovernance", "-txindex=0"])
|
self.start_node(node_number, extra_args=["-disablegovernance", "-txindex=0"] + DEPLOYMENT_ARGS)
|
||||||
node = self.nodes[node_number]
|
node = self.nodes[node_number]
|
||||||
assert_equal(node.getblockcount(), 995)
|
assert_equal(node.getblockcount(), 995)
|
||||||
assert_raises_rpc_error(-1, "Cannot prune blocks because node is not in prune mode", node.pruneblockchain, 500)
|
assert_raises_rpc_error(-1, "Cannot prune blocks because node is not in prune mode", node.pruneblockchain, 500)
|
||||||
|
|
||||||
# now re-start in manual pruning mode
|
# now re-start in manual pruning mode
|
||||||
self.restart_node(node_number, extra_args=["-dip3params=2000:2000", "-testactivationheight=dip0008@2000", "-disablegovernance", "-txindex=0", "-prune=1"], expected_stderr=EXPECTED_STDERR_NO_GOV)
|
self.restart_node(node_number, extra_args=["-disablegovernance", "-txindex=0", "-prune=1"] + DEPLOYMENT_ARGS, expected_stderr=EXPECTED_STDERR_NO_GOV)
|
||||||
node = self.nodes[node_number]
|
node = self.nodes[node_number]
|
||||||
assert_equal(node.getblockcount(), 995)
|
assert_equal(node.getblockcount(), 995)
|
||||||
|
|
||||||
@ -358,14 +365,14 @@ class PruneTest(BitcoinTestFramework):
|
|||||||
assert not has_block(3), "blk00003.dat is still there, should be pruned by now"
|
assert not has_block(3), "blk00003.dat is still there, should be pruned by now"
|
||||||
|
|
||||||
# stop node, start back up with auto-prune at 550 MiB, make sure still runs
|
# stop node, start back up with auto-prune at 550 MiB, make sure still runs
|
||||||
self.restart_node(node_number, extra_args=["-dip3params=2000:2000", "-testactivationheight=dip0008@2000", "-disablegovernance", "-txindex=0", "-prune=550"], expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE)
|
self.restart_node(node_number, extra_args=["-disablegovernance", "-txindex=0", "-prune=550"] + DEPLOYMENT_ARGS, expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE)
|
||||||
|
|
||||||
self.log.info("Success")
|
self.log.info("Success")
|
||||||
|
|
||||||
def wallet_test(self):
|
def wallet_test(self):
|
||||||
# check that the pruning node's wallet is still in good shape
|
# check that the pruning node's wallet is still in good shape
|
||||||
self.log.info("Stop and start pruning node to trigger wallet rescan")
|
self.log.info("Stop and start pruning node to trigger wallet rescan")
|
||||||
self.restart_node(2, extra_args=["-dip3params=2000:2000", "-testactivationheight=dip0008@2000", "-disablegovernance", "-txindex=0", "-prune=550"], expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE)
|
self.restart_node(2, extra_args=["-disablegovernance", "-txindex=0", "-prune=550"] + DEPLOYMENT_ARGS, expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE)
|
||||||
self.log.info("Success")
|
self.log.info("Success")
|
||||||
|
|
||||||
# check that wallet loads successfully when restarting a pruned node after IBD.
|
# check that wallet loads successfully when restarting a pruned node after IBD.
|
||||||
@ -374,7 +381,7 @@ class PruneTest(BitcoinTestFramework):
|
|||||||
self.connect_nodes(0, 5)
|
self.connect_nodes(0, 5)
|
||||||
nds = [self.nodes[0], self.nodes[5]]
|
nds = [self.nodes[0], self.nodes[5]]
|
||||||
self.sync_blocks(nds, wait=5, timeout=300)
|
self.sync_blocks(nds, wait=5, timeout=300)
|
||||||
self.restart_node(5, extra_args=["-dip3params=2000:2000", "-testactivationheight=dip0008@2000", "-disablegovernance", "-txindex=0", "-prune=550"], expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE) # restart to trigger rescan
|
self.restart_node(5, extra_args=["-disablegovernance", "-txindex=0", "-prune=550"] + DEPLOYMENT_ARGS, expected_stderr=EXPECTED_STDERR_NO_GOV_PRUNE) # restart to trigger rescan
|
||||||
self.log.info("Success")
|
self.log.info("Success")
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user