aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-05-02 13:59:53 -0400
committerMarcoFalke <falke.marco@gmail.com>2020-05-04 10:40:48 -0400
commitfa47cf9d95dc2c2822fc96df16f179176935bf96 (patch)
tree9bd93ec524acedceab4c4c25307f80fc3d70764f /src/wallet
parentae32e5ce3d268881cbf631de1903b2a414bb64e1 (diff)
wallet: Fix typo in assert that is compile-time true
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 7a6deab1a8..561bdd1b9c 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -2777,7 +2777,10 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std
strFailReason = _("Transaction needs a change address, but we can't generate it. Please call keypoolrefill first.").translated;
}
scriptChange = GetScriptForDestination(dest);
- assert(!dest.empty() || scriptChange.empty());
+ // 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.
+ CHECK_NONFATAL(IsValidDestination(dest) != scriptChange.empty());
}
CTxOut change_prototype_txout(0, scriptChange);
coin_selection_params.change_output_size = GetSerializeSize(change_prototype_txout);
@@ -2994,7 +2997,7 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std
continue;
}
- // Give up if change keypool ran out and we failed to find a solution without change:
+ // Give up if change keypool ran out and change is required
if (scriptChange.empty() && nChangePosInOut != -1) {
return false;
}