wallet: Fix typo in assert that is compile-time true
This commit is contained in:
parent
ae32e5ce3d
commit
fa47cf9d95
2 changed files with 11 additions and 2 deletions
|
@ -13,6 +13,12 @@
|
||||||
|
|
||||||
BOOST_FIXTURE_TEST_SUITE(script_standard_tests, BasicTestingSetup)
|
BOOST_FIXTURE_TEST_SUITE(script_standard_tests, BasicTestingSetup)
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(dest_default_is_no_dest)
|
||||||
|
{
|
||||||
|
CTxDestination dest;
|
||||||
|
BOOST_CHECK(!IsValidDestination(dest));
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(script_standard_Solver_success)
|
BOOST_AUTO_TEST_CASE(script_standard_Solver_success)
|
||||||
{
|
{
|
||||||
CKey keys[3];
|
CKey keys[3];
|
||||||
|
|
|
@ -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;
|
strFailReason = _("Transaction needs a change address, but we can't generate it. Please call keypoolrefill first.").translated;
|
||||||
}
|
}
|
||||||
scriptChange = GetScriptForDestination(dest);
|
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);
|
CTxOut change_prototype_txout(0, scriptChange);
|
||||||
coin_selection_params.change_output_size = GetSerializeSize(change_prototype_txout);
|
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;
|
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) {
|
if (scriptChange.empty() && nChangePosInOut != -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue