mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
refactor: combine Chain::findFirstBlockWithTime/findFirstBlockWithTimeAndHeight
As suggested in #14711, pass height to CChain::FindEarliestAtLeast to simplify Chain interface by combining findFirstBlockWithTime and findFirstBlockWithTimeAndHeight into one Extend findearliestatleast_edge_test in consequence
This commit is contained in:
@@ -1007,7 +1007,7 @@ static UniValue pruneblockchain(const JSONRPCRequest& request)
|
||||
// too low to be a block time (corresponds to timestamp from Sep 2001).
|
||||
if (heightParam > 1000000000) {
|
||||
// Add a 2 hour buffer to include blocks which might have had old timestamps
|
||||
CBlockIndex* pindex = chainActive.FindEarliestAtLeast(heightParam - TIMESTAMP_WINDOW);
|
||||
CBlockIndex* pindex = chainActive.FindEarliestAtLeast(heightParam - TIMESTAMP_WINDOW, 0);
|
||||
if (!pindex) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Could not find block with at least the specified timestamp.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user