diff options
| author | Gregory Maxwell <[email protected]> | 2016-12-14 01:50:00 +0000 |
|---|---|---|
| committer | Gregory Maxwell <[email protected]> | 2016-12-14 01:50:00 +0000 |
| commit | da9cdd2c9cb58e3737b727c21f070f074b1247a7 (patch) | |
| tree | 8d5c6661ab4f74df189fb2966900d6577e07752d /src/validation.cpp | |
| parent | Merge #9326: Update for OpenSSL 1.1 API. (diff) | |
| download | discoin-da9cdd2c9cb58e3737b727c21f070f074b1247a7.tar.xz discoin-da9cdd2c9cb58e3737b727c21f070f074b1247a7.zip | |
Do not run functions with necessary side-effects in assert()
Diffstat (limited to 'src/validation.cpp')
| -rw-r--r-- | src/validation.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index 7163b99a6..457455af4 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2100,7 +2100,8 @@ bool static DisconnectTip(CValidationState& state, const CChainParams& chainpara CCoinsViewCache view(pcoinsTip); if (!DisconnectBlock(block, state, pindexDelete, view)) 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. @@ -2189,7 +2190,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); |