Skip to content

Commit d3e8458

Browse files
committed
rpc: Show scanning details in getwalletinfo
1 parent 90e27ab commit d3e8458

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,6 +2402,11 @@ static UniValue getwalletinfo(const JSONRPCRequest& request)
24022402
" \"paytxfee\": x.xxxx, (numeric) the transaction fee configuration, set in " + CURRENCY_UNIT + "/kB\n"
24032403
" \"hdseedid\": \"<hash160>\" (string, optional) the Hash160 of the HD seed (only present when HD is enabled)\n"
24042404
" \"private_keys_enabled\": true|false (boolean) false if privatekeys are disabled for this wallet (enforced watch-only wallet)\n"
2405+
" \"scanning\": (json object) current scanning details, or false if no scan is in progress\n"
2406+
" {\n"
2407+
" \"duration\" : xxxx (numeric) elapsed seconds since scan start\n"
2408+
" \"progress\" : x.xxxx, (numeric) scanning progress percentage [0.0, 1.0]\n"
2409+
" }\n"
24052410
"}\n"
24062411
},
24072412
RPCExamples{
@@ -2441,6 +2446,14 @@ static UniValue getwalletinfo(const JSONRPCRequest& request)
24412446
obj.pushKV("hdseedid", seed_id.GetHex());
24422447
}
24432448
obj.pushKV("private_keys_enabled", !pwallet->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS));
2449+
if (pwallet->IsScanning()) {
2450+
UniValue scanning(UniValue::VOBJ);
2451+
scanning.pushKV("duration", pwallet->ScanningDuration() / 1000);
2452+
scanning.pushKV("progress", pwallet->ScanningProgress());
2453+
obj.pushKV("scanning", scanning);
2454+
} else {
2455+
obj.pushKV("scanning", false);
2456+
}
24442457
return obj;
24452458
}
24462459

0 commit comments

Comments
 (0)