diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2570,7 +2570,7 @@ // If this is a parked chain, but it has enough PoW, clear the park // state. bool fParkedChain = pindexTest->nStatus.isOnParkedChain(); - if (fParkedChain && gArgs.GetBoolArg("-parkdeepreorg", true)) { + if (fParkedChain) { const CBlockIndex *pindexTip = chainActive.Tip(); // During initialization, pindexTip and/or pindexFork may be diff --git a/test/functional/abc-parkedchain.py b/test/functional/abc-parkedchain.py --- a/test/functional/abc-parkedchain.py +++ b/test/functional/abc-parkedchain.py @@ -5,7 +5,7 @@ """Test the parckblock and unparkblock RPC calls.""" from test_framework.test_framework import BitcoinTestFramework -from test_framework.util import assert_equal, wait_until +from test_framework.util import assert_equal, connect_nodes_bi, wait_until class ParkedChainTest(BitcoinTestFramework): @@ -188,6 +188,29 @@ check_reorg_protection(6, 6) check_reorg_protection(100, 100) + self.log.info("Test that unparking works when -parkdeepreorg=0") + # Set up parking node height = fork + 4, node height = fork + 5 + node.invalidateblock(node.getbestblockhash()) + parking_node.generate(3) + node.generate(5) + wait_for_parked_block(node.getbestblockhash()) + # Restart the parking node without parkdeepreorg. + self.restart_node(1, ["-parkdeepreorg=0"]) + parking_node = self.nodes[1] + connect_nodes_bi(node, parking_node) + # The other chain should still be marked 'parked'. + wait_for_parked_block(node.getbestblockhash()) + # Two more blocks is not enough to unpark. Even though PoW is larger + # we are still following the delayed-unparking rules. + node.generate(2) + wait_for_parked_block(node.getbestblockhash()) + # Final block pushes over the edge, and should unpark. + node.generate(1) + wait_until(lambda: parking_node.getbestblockhash() + == node.getbestblockhash(), timeout=5) + # Do not append tests after this point without restarting node again. + # Parking node is no longer parking. + if __name__ == '__main__': ParkedChainTest().main()