aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/spend.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2021-06-12 21:36:05 -0400
committerAndrew Chow <achow101-github@achow101.com>2021-06-22 21:57:04 -0400
commit754f134a50cc56cdf0baf996d909c992770fcc97 (patch)
tree6254beb3d43175e1383014a1f80daa10c60b42cc /src/wallet/spend.cpp
parent87a0e7a3b7c0ffd545e537bd497cdc3e67d045f6 (diff)
downloadbitcoin-754f134a50cc56cdf0baf996d909c992770fcc97.tar.xz
wallet: Add error message to GetReservedDestination
Adds an error output parameter to all GetReservedDestination functions so that callers can get the actual reason that a change address could not be fetched. This more closely matches GetNewDestination. This allows for more granular error messages, such as one that indicates that bech32m addresses cannot be generated yet.
Diffstat (limited to 'src/wallet/spend.cpp')
-rw-r--r--src/wallet/spend.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
index c8ded4c51e..6a8df437ae 100644
--- a/src/wallet/spend.cpp
+++ b/src/wallet/spend.cpp
@@ -618,8 +618,9 @@ bool CWallet::CreateTransactionInternal(
// Reserve a new key pair from key pool. If it fails, provide a dummy
// destination in case we don't need change.
CTxDestination dest;
- if (!reservedest.GetReservedDestination(dest, true)) {
- error = _("Transaction needs a change address, but we can't generate it. Please call keypoolrefill first.");
+ std::string dest_err;
+ if (!reservedest.GetReservedDestination(dest, true, dest_err)) {
+ error = strprintf(_("Transaction needs a change address, but we can't generate it. %s"), dest_err);
}
scriptChange = GetScriptForDestination(dest);
// A valid destination implies a change script (and