diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2022-03-21 18:38:54 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2022-06-03 07:20:07 +0000 |
commit | e593ae07c4fb41a26c95dbd03301607fc5b4d5e2 (patch) | |
tree | 22cb7df25420cb6ba7e6b97cfc45414611250dcf /src | |
parent | 2cf8c2caea90d9a3c314ba5f88bb76b3b5273d62 (diff) | |
download | bitcoin-e593ae07c4fb41a26c95dbd03301607fc5b4d5e2.tar.xz |
Bugfix: RPC/blockchain: pruneblockchain: Return the height of the actual last pruned block
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.
Diffstat (limited to 'src')
-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); }, }; } |