diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2022-07-20 19:06:57 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2022-08-05 17:19:09 +0200 |
commit | 76b3c37fcb93b4bcb047e0500fdaa605160e25d5 (patch) | |
tree | 19111f09b156efcb3ea47bf0652057a55eef91a5 /src/wallet/spend.cpp | |
parent | 006740b6f6475ed6ae08803c60dd82027602695b (diff) | |
download | bitcoin-76b3c37fcb93b4bcb047e0500fdaa605160e25d5.tar.xz |
refactor: wallet: return util::Result from `GetReservedDestination` methods
Diffstat (limited to 'src/wallet/spend.cpp')
-rw-r--r-- | src/wallet/spend.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp index 5d320feff0..cb8a273dfc 100644 --- a/src/wallet/spend.cpp +++ b/src/wallet/spend.cpp @@ -812,11 +812,13 @@ static util::Result<CreatedTransactionResult> 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; - bilingual_str dest_err; - if (!reservedest.GetReservedDestination(dest, true, dest_err)) { - error = _("Transaction needs a change address, but we can't generate it.") + Untranslated(" ") + dest_err; + auto op_dest = reservedest.GetReservedDestination(true); + if (!op_dest) { + error = _("Transaction needs a change address, but we can't generate it.") + Untranslated(" ") + util::ErrorString(op_dest); + } else { + dest = *op_dest; + scriptChange = GetScriptForDestination(dest); } - scriptChange = GetScriptForDestination(dest); // A valid destination implies a change script (and // vice-versa). An empty change script will abort later, if the // change keypool ran out, but change is required. |