Do not run functions with necessary side-effects in assert()

This commit is contained in:
practicalswift
2020-12-05 10:50:20 +00:00
parent f35e4d906f
commit 281cf99554
2 changed files with 8 additions and 4 deletions

View File

@ -64,7 +64,8 @@ static void add_coin(CWallet& wallet, const CAmount& nValue, int nAge = 6*24, bo
if (spendable) {
CTxDestination dest;
std::string error;
assert(wallet.GetNewDestination(OutputType::BECH32, "", dest, error));
const bool destination_ok = wallet.GetNewDestination(OutputType::BECH32, "", dest, error);
assert(destination_ok);
tx.vout[nInput].scriptPubKey = GetScriptForDestination(dest);
}
if (fIsFromMe) {