diff --git a/doc/release-notes.md b/doc/release-notes.md --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -13,3 +13,4 @@ - Improved help message for backup wallet RPC - Various bug fixes that improve node stability and performance - Backport getblock RPC's new verbosity mode from bitcoin core for retrieving all transactions of a given block in full. + - Added 'parked' state to getchaintips RPC diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1332,13 +1332,15 @@ "Possible values for status:\n" "1. \"invalid\" This branch contains at least one " "invalid block\n" - "2. \"headers-only\" Not all blocks for this branch are " + "2. \"parked\" This branch contains at least one " + "parked block\n" + "3. \"headers-only\" Not all blocks for this branch are " "available, but the headers are valid\n" - "3. \"valid-headers\" All blocks are available for this " + "4. \"valid-headers\" All blocks are available for this " "branch, but they were never fully validated\n" - "4. \"valid-fork\" This branch is not part of the " + "5. \"valid-fork\" This branch is not part of the " "active chain, but is fully validated\n" - "5. \"active\" This is the tip of the active main " + "6. \"active\" This is the tip of the active main " "chain, which is certainly valid\n" "\nExamples:\n" + HelpExampleCli("getchaintips", "") + @@ -1396,6 +1398,9 @@ } else if (block->nStatus.isInvalid()) { // This block or one of its ancestors is invalid. status = "invalid"; + } else if (block->nStatus.isOnParkedChain()) { + // This block or one of its ancestors is parked. + status = "parked"; } else if (block->nChainTx == 0) { // This block cannot be connected because full block data for it or // one of its parents is missing. 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 @@ -74,14 +74,14 @@ good_tip = node.getbestblockhash() node.parkblock(bad_tip) - self.only_valid_tip(tip, other_tip_status="valid-fork") + self.only_valid_tip(tip, other_tip_status="parked") node.invalidateblock(bad_tip) # NOTE: Intuitively, other_tip_status would be "invalid", but because # only valid (unparked) chains are walked, child blocks' statuses are - # not updated, so the "valid-fork" state remains. - self.only_valid_tip(tip, other_tip_status="valid-fork") + # not updated, so the "parked" state remains. + self.only_valid_tip(tip, other_tip_status="parked") node.reconsiderblock(bad_tip) - self.only_valid_tip(tip, other_tip_status="valid-fork") + self.only_valid_tip(tip, other_tip_status="parked") node.unparkblock(bad_tip) self.only_valid_tip(good_tip) @@ -98,7 +98,7 @@ node.parkblock(bad_tip) self.only_valid_tip(tip, other_tip_status="invalid") node.reconsiderblock(bad_tip) - self.only_valid_tip(tip, other_tip_status="valid-fork") + self.only_valid_tip(tip, other_tip_status="parked") node.unparkblock(bad_tip) self.only_valid_tip(good_tip) @@ -111,12 +111,12 @@ good_tip = node.getbestblockhash() node.parkblock(bad_tip) - self.only_valid_tip(tip, other_tip_status="valid-fork") + self.only_valid_tip(tip, other_tip_status="parked") node.invalidateblock(bad_tip) # NOTE: Intuitively, other_tip_status would be "invalid", but because # only valid (unparked) chains are walked, child blocks' statuses are - # not updated, so the "valid-fork" state remains. - self.only_valid_tip(tip, other_tip_status="valid-fork") + # not updated, so the "parked" state remains. + self.only_valid_tip(tip, other_tip_status="parked") node.unparkblock(bad_tip) self.only_valid_tip(tip, other_tip_status="invalid") node.reconsiderblock(bad_tip)