Merge pull request #1327 from psgreco/master-nopegin-ibd

getpeginaddress cannot be trusted during ibd, it should fail
This commit is contained in:
Byron Hambly 2024-04-19 17:17:15 +02:00 committed by GitHub
commit 5f1cc1ad8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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");