diff options
author | Jonas Schnelli <dev@jonasschnelli.ch> | 2019-05-09 13:56:01 +0200 |
---|---|---|
committer | Jonas Schnelli <dev@jonasschnelli.ch> | 2019-06-11 10:21:40 +0200 |
commit | 97f517dd851450b1ede1eb6b20f77691883a7737 (patch) | |
tree | 2506286631d845dcd13f7a04f011e6df91d4b5f7 | |
parent | 8a503a6c6dd419921373f45d7aa6f1787c9b8884 (diff) |
Fix RPC/pruneblockchain returned prune height
-rw-r--r-- | src/rpc/blockchain.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 49d7ae2016..50c4589d9f 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1061,7 +1061,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) |