aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2019-05-09 13:56:01 +0200
committerMarcoFalke <falke.marco@gmail.com>2019-06-14 16:01:37 -0400
commitc80a498ae532ad4a8e8027cd8f1057785608b3fc (patch)
treefb9b85687191364e81b43deb6bb41ae3a01f146b /src
parentb2398240ff901715dab39a98b04d4eb9e0a462ae (diff)
downloadbitcoin-c80a498ae532ad4a8e8027cd8f1057785608b3fc.tar.xz
Fix RPC/pruneblockchain returned prune height
Github-Pull: #15991 Rebased-From: 97f517dd851450b1ede1eb6b20f77691883a7737
Diffstat (limited to 'src')
-rw-r--r--src/rpc/blockchain.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 6fa472d442..bd35163074 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -1030,7 +1030,12 @@ static UniValue pruneblockchain(const JSONRPCRequest& request)
}
PruneBlockFilesManual(height);
- return uint64_t(height);
+ const CBlockIndex* block = ::chainActive.Tip();
+ assert(block);
+ while (block->pprev && (block->pprev->nStatus & BLOCK_HAVE_DATA)) {
+ block = block->pprev;
+ }
+ return uint64_t(block->nHeight);
}
static UniValue gettxoutsetinfo(const JSONRPCRequest& request)