diff options
author | MacroFake <falke.marco@gmail.com> | 2022-06-07 08:04:45 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-06-07 08:04:51 +0200 |
commit | 581e2bdbac6f531ee4bdd8b3c9b317740bfe5cbf (patch) | |
tree | 4633c91b0d969a72e650f9dddd0b426f10224d9b /src/rpc | |
parent | 06ea2783a2c11e7b171e2809c3211bb3091d894d (diff) | |
parent | e593ae07c4fb41a26c95dbd03301607fc5b4d5e2 (diff) |
Merge bitcoin/bitcoin#24629: Bugfix: RPC/blockchain: pruneblockchain: Return the height of the actual last pruned block
e593ae07c4fb41a26c95dbd03301607fc5b4d5e2 Bugfix: RPC/blockchain: pruneblockchain: Return the height of the actual last pruned block (Luke Dashjr)
Pull request description:
From 0.14 (2017 Mar) until before 0.19 (2019 Nov), the height of the last block pruned was returned, subject to a bug if there were blocks left unpruned due to sharing files with later blocks.
In #15991, this was "fixed" to the current implementation, introducing a new bug: now, it returns the first *unpruned* block.
Since the user provides the parameter as a block to include in pruning, it makes more sense to fix the behaviour to match the documentation.
~~(Additionally, the description of "pruneheight" in getblockchaininfo is fixed to be technically correct)~~
ACKs for top commit:
fjahr:
utACK e593ae07c4fb41a26c95dbd03301607fc5b4d5e2
ryanofsky:
Code review ACK e593ae07c4fb41a26c95dbd03301607fc5b4d5e2. Just rebased since last review. Maybe some of the original reviewers of #15991 will want to take a look at this to correct the mistake that was introduced there!
Tree-SHA512: c2d511df80682d57260aae8af1665f9d7eaed16448f185f4c9f23c78fa9b8289a02053da7a0b83643fef57610d601ea63b59ff39661a51f4827f1eb27cc30594
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/blockchain.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index f2186c131f..d682a7d3e8 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -790,7 +790,7 @@ static RPCHelpMan pruneblockchain() const CBlockIndex& block{*CHECK_NONFATAL(active_chain.Tip())}; const CBlockIndex* last_block{active_chainstate.m_blockman.GetFirstStoredBlock(block)}; - return static_cast<uint64_t>(last_block->nHeight); + return static_cast<int64_t>(last_block->nHeight - 1); }, }; } |