Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 4,086 Lines • ▼ Show 20 Lines | if (fPruneMode) { | ||||
"Can't rescan beyond pruned data. Use RPC " | "Can't rescan beyond pruned data. Use RPC " | ||||
"call getblockchaininfo to determine your " | "call getblockchaininfo to determine your " | ||||
"pruned height."); | "pruned height."); | ||||
} | } | ||||
block = block->pprev; | block = block->pprev; | ||||
} | } | ||||
} | } | ||||
const CBlockIndex *stopBlock = pwallet->ScanForWalletTransactions( | const CBlockIndex *stopBlock; | ||||
pindexStart, pindexStop, reserver, true); | CWallet::ScanResult result = pwallet->ScanForWalletTransactions( | ||||
if (!stopBlock) { | pindexStart, pindexStop, reserver, stopBlock, true); | ||||
if (pwallet->IsAbortingRescan()) { | switch (result) { | ||||
throw JSONRPCError(RPC_MISC_ERROR, "Rescan aborted."); | case CWallet::ScanResult::SUCCESS: | ||||
} | |||||
// if we got a nullptr returned, ScanForWalletTransactions did rescan up | |||||
// to the requested stopindex | |||||
stopBlock = pindexStop ? pindexStop : pChainTip; | stopBlock = pindexStop ? pindexStop : pChainTip; | ||||
} else { | break; | ||||
throw JSONRPCError(RPC_MISC_ERROR, | case CWallet::ScanResult::FAILURE: | ||||
throw JSONRPCError( | |||||
RPC_MISC_ERROR, | |||||
"Rescan failed. Potentially corrupted data files."); | "Rescan failed. Potentially corrupted data files."); | ||||
case CWallet::ScanResult::USER_ABORT: | |||||
throw JSONRPCError(RPC_MISC_ERROR, "Rescan aborted."); | |||||
// no default case, so the compiler can warn about missing cases | |||||
} | } | ||||
UniValue response(UniValue::VOBJ); | UniValue response(UniValue::VOBJ); | ||||
response.pushKV("start_height", pindexStart->nHeight); | response.pushKV("start_height", pindexStart->nHeight); | ||||
response.pushKV("stop_height", stopBlock->nHeight); | response.pushKV("stop_height", stopBlock->nHeight); | ||||
return response; | return response; | ||||
} | } | ||||
class DescribeWalletAddressVisitor : public boost::static_visitor<UniValue> { | class DescribeWalletAddressVisitor : public boost::static_visitor<UniValue> { | ||||
▲ Show 20 Lines • Show All 880 Lines • Show Last 20 Lines |