Skip to content

Commit

Permalink
Merge pull request #1327 from psgreco/master-nopegin-ibd
Browse files Browse the repository at this point in the history
getpeginaddress cannot be trusted during ibd, it should fail
  • Loading branch information
delta1 authored Apr 19, 2024
2 parents 99e502f + 33a1560 commit 5f1cc1a
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 5f1cc1a

Please sign in to comment.