Skip to content

Commit

Permalink
Merge bitcoin#9344: Do not run functions with necessary side-effects …
Browse files Browse the repository at this point in the history
…in assert()

da9cdd2 Do not run functions with necessary side-effects in assert() (Gregory Maxwell)
  • Loading branch information
laanwj authored and CryptoCentric committed Feb 25, 2019
1 parent c253c37 commit 7da0aaf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/validation.cpp
Expand Up @@ -2520,7 +2520,8 @@ bool static DisconnectTip(CValidationState& state, const CChainParams& chainpara
CCoinsViewCache view(pcoinsTip);
if (DisconnectBlock(block, state, pindexDelete, view) != DISCONNECT_OK)
return error("DisconnectTip(): DisconnectBlock %s failed", pindexDelete->GetBlockHash().ToString());
assert(view.Flush());
bool flushed = view.Flush();
assert(flushed);
}
LogPrint("bench", "- Disconnect block: %.2fms\n", (GetTimeMicros() - nStart) * 0.001);
// Write the chain state to disk, if necessary.
Expand Down Expand Up @@ -2605,7 +2606,8 @@ bool static ConnectTip(CValidationState& state, const CChainParams& chainparams,
}
nTime3 = GetTimeMicros(); nTimeConnectTotal += nTime3 - nTime2;
LogPrint("bench", " - Connect total: %.2fms [%.2fs]\n", (nTime3 - nTime2) * 0.001, nTimeConnectTotal * 0.000001);
assert(view.Flush());
bool flushed = view.Flush();
assert(flushed);
}
int64_t nTime4 = GetTimeMicros(); nTimeFlush += nTime4 - nTime3;
LogPrint("bench", " - Flush: %.2fms [%.2fs]\n", (nTime4 - nTime3) * 0.001, nTimeFlush * 0.000001);
Expand Down

0 comments on commit 7da0aaf

Please sign in to comment.