Fix RPC/pruneblockchain returned prune height

This commit is contained in:
Jonas Schnelli 2019-05-09 13:56:01 +02:00
parent 8a503a6c6d
commit 97f517dd85
No known key found for this signature in database
GPG key ID: 1EB776BB03C7922D

View file

@ -1061,7 +1061,12 @@ static UniValue pruneblockchain(const JSONRPCRequest& request)
} }
PruneBlockFilesManual(height); 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) static UniValue gettxoutsetinfo(const JSONRPCRequest& request)