mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Merge #9778: Add two hour buffer to manual pruning
91fb506
Add two hour buffer to manual pruning (Alex Morcos)
This commit is contained in:
parent
86fd57b8cd
commit
0080fde36a
@ -954,7 +954,8 @@ UniValue pruneblockchain(const JSONRPCRequest& request)
|
|||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"pruneblockchain\n"
|
"pruneblockchain\n"
|
||||||
"\nArguments:\n"
|
"\nArguments:\n"
|
||||||
"1. \"height\" (numeric, required) The block height to prune up to. May be set to a discrete height, or to a unix timestamp to prune based on block time.\n"
|
"1. \"height\" (numeric, required) The block height to prune up to. May be set to a discrete height, or a unix timestamp\n"
|
||||||
|
" to prune blocks whose block time is at least 2 hours older than the provided timestamp.\n"
|
||||||
"\nResult:\n"
|
"\nResult:\n"
|
||||||
"n (numeric) Height of the last block pruned.\n"
|
"n (numeric) Height of the last block pruned.\n"
|
||||||
"\nExamples:\n"
|
"\nExamples:\n"
|
||||||
@ -973,7 +974,8 @@ UniValue pruneblockchain(const JSONRPCRequest& request)
|
|||||||
// Height value more than a billion is too high to be a block height, and
|
// Height value more than a billion is too high to be a block height, and
|
||||||
// too low to be a block time (corresponds to timestamp from Sep 2001).
|
// too low to be a block time (corresponds to timestamp from Sep 2001).
|
||||||
if (heightParam > 1000000000) {
|
if (heightParam > 1000000000) {
|
||||||
CBlockIndex* pindex = chainActive.FindEarliestAtLeast(heightParam);
|
// Add a 2 hour buffer to include blocks which might have had old timestamps
|
||||||
|
CBlockIndex* pindex = chainActive.FindEarliestAtLeast(heightParam - 7200);
|
||||||
if (!pindex) {
|
if (!pindex) {
|
||||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Could not find block with at least the specified timestamp.");
|
throw JSONRPCError(RPC_INTERNAL_ERROR, "Could not find block with at least the specified timestamp.");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user