From b5cefbe1aef48ed163a0f92a31388fa5e28debf4 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Mon, 13 Jan 2020 09:29:50 -0500 Subject: [PATCH] getwalletpakinfo: Use offline counter when reporting lookahead --- src/wallet/rpcdump.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index fd5bc3b3a0..413a1d3894 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -1601,8 +1601,11 @@ UniValue getwalletpakinfo(const JSONRPCRequest& request) ret.pushKV("liquid_pak", HexStr(pwallet->online_key)); ret.pushKV("liquid_pak_address", EncodeDestination(PKHash(pwallet->online_key))); + // We know that the number is non-negative from earlier check + unsigned int counter = (unsigned int)pwallet->offline_counter; + UniValue address_list(UniValue::VARR); - for (unsigned int i = 0; i < 3; i++) { + for (unsigned int i = counter; i < counter+3; i++) { std::vector scripts; if (!desc->Expand(i, provider, scripts, provider)) { throw JSONRPCError(RPC_WALLET_ERROR, "Could not generate lookahead addresses with descriptor. This is a bug.");