mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-21 04:09:09 +02:00
Merge bitcoin/bitcoin#24629: Bugfix: RPC/blockchain: pruneblockchain: Return the height of the actual last pruned block
e593ae07c4Bugfix: 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: utACKe593ae07c4ryanofsky: Code review ACKe593ae07c4. 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
This commit is contained in:
@@ -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);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user