From 3c19fdd2a2fd5394fcfa75b2ba84ab2277cbdabf Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Thu, 13 Feb 2020 21:06:29 -0500 Subject: Return error when no ScriptPubKeyMan is available for specified type When a CWallet doesn't have a ScriptPubKeyMan for the requested type in GetNewDestination, give a meaningful error. Also handle this in Qt which did not do anything with errors. --- src/wallet/wallet.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/wallet') diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 5ffeb9e44d..19ad61ac5e 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3227,6 +3227,8 @@ bool CWallet::GetNewDestination(const OutputType type, const std::string label, if (spk_man) { spk_man->TopUp(); result = spk_man->GetNewDestination(type, dest, error); + } else { + error = strprintf("Error: No %s addresses available.", FormatOutputType(type)); } if (result) { SetAddressBook(dest, label, "receive"); -- cgit v1.2.3