Skip to content

Commit

Permalink
getpeginaddress cannot be trusted during ibd, it should fail
Browse files Browse the repository at this point in the history
  • Loading branch information
psgreco committed Apr 19, 2024
1 parent 99e502f commit 33a1560
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/wallet/rpc/elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 33a1560

Please sign in to comment.