From 33a15604e8b3254321ea3456b9d2d96d2a7288d3 Mon Sep 17 00:00:00 2001 From: Pablo Greco Date: Thu, 18 Apr 2024 17:41:36 -0700 Subject: [PATCH] getpeginaddress cannot be trusted during ibd, it should fail --- src/wallet/rpc/elements.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wallet/rpc/elements.cpp b/src/wallet/rpc/elements.cpp index 612f67541e..3bfa4253a2 100644 --- a/src/wallet/rpc/elements.cpp +++ b/src/wallet/rpc/elements.cpp @@ -174,6 +174,10 @@ RPCHelpMan getpeginaddress() if (!wallet) return NullUniValue; CWallet* const pwallet = wallet.get(); + if (pwallet->chain().isInitialBlockDownload()) { + throw JSONRPCError(RPC_WALLET_ERROR, "This action cannot be completed during initial sync or reindexing."); + } + LegacyScriptPubKeyMan* spk_man = pwallet->GetLegacyScriptPubKeyMan(); if (!spk_man) { throw JSONRPCError(RPC_WALLET_ERROR, "This type of wallet does not support this command");