Skip to content

Commit c80a498

Browse files
jonasschnelliMarcoFalke
authored andcommitted
Fix RPC/pruneblockchain returned prune height
Github-Pull: #15991 Rebased-From: 97f517d
1 parent b239824 commit c80a498

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/rpc/blockchain.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,12 @@ static UniValue pruneblockchain(const JSONRPCRequest& request)
10301030
}
10311031

10321032
PruneBlockFilesManual(height);
1033-
return uint64_t(height);
1033+
const CBlockIndex* block = ::chainActive.Tip();
1034+
assert(block);
1035+
while (block->pprev && (block->pprev->nStatus & BLOCK_HAVE_DATA)) {
1036+
block = block->pprev;
1037+
}
1038+
return uint64_t(block->nHeight);
10341039
}
10351040

10361041
static UniValue gettxoutsetinfo(const JSONRPCRequest& request)

0 commit comments

Comments
 (0)