aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpcwallet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r--src/wallet/rpcwallet.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index c96a9b0aff..8a7323b58c 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -3412,8 +3412,8 @@ UniValue rescanblockchain(const JSONRPCRequest& request)
},
RPCResult{
"{\n"
- " \"start_height\" (numeric) The block height where the rescan has started.\n"
- " \"stop_height\" (numeric) The height of the last rescanned block.\n"
+ " \"start_height\" (numeric) The block height where the rescan started (the requested height or 0)\n"
+ " \"stop_height\" (numeric) The height of the last rescanned block. May be null in rare cases if there was a reorg and the call didn't scan any blocks because they were already scanned in the background.\n"
"}\n"
},
RPCExamples{
@@ -3459,6 +3459,11 @@ UniValue rescanblockchain(const JSONRPCRequest& request)
if (tip_height) {
start_block = locked_chain->getBlockHash(start_height);
+ // If called with a stop_height, set the stop_height here to
+ // trigger a rescan to that height.
+ // If called without a stop height, leave stop_height as null here
+ // so rescan continues to the tip (even if the tip advances during
+ // rescan).
if (stop_height) {
stop_block = locked_chain->getBlockHash(*stop_height);
}
@@ -3478,7 +3483,7 @@ UniValue rescanblockchain(const JSONRPCRequest& request)
}
UniValue response(UniValue::VOBJ);
response.pushKV("start_height", start_height);
- response.pushKV("stop_height", result.stop_height ? *result.stop_height : UniValue());
+ response.pushKV("stop_height", result.last_scanned_height ? *result.last_scanned_height : UniValue());
return response;
}