|
27 | 27 | using namespace std;
|
28 | 28 | using namespace boost;
|
29 | 29 |
|
| 30 | +#if defined(NDEBUG) |
| 31 | +# error "Bitcoin cannot be compiled without assertions." |
| 32 | +#endif |
| 33 | + |
30 | 34 | //
|
31 | 35 | // Global state
|
32 | 36 | //
|
@@ -1266,18 +1270,21 @@ void UpdateTime(CBlockHeader& block, const CBlockIndex* pindexPrev)
|
1266 | 1270 |
|
1267 | 1271 | void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight, const uint256 &txhash)
|
1268 | 1272 | {
|
| 1273 | + bool ret; |
1269 | 1274 | // mark inputs spent
|
1270 | 1275 | if (!tx.IsCoinBase()) {
|
1271 | 1276 | BOOST_FOREACH(const CTxIn &txin, tx.vin) {
|
1272 | 1277 | CCoins &coins = inputs.GetCoins(txin.prevout.hash);
|
1273 | 1278 | CTxInUndo undo;
|
1274 |
| - assert(coins.Spend(txin.prevout, undo)); |
| 1279 | + ret = coins.Spend(txin.prevout, undo); |
| 1280 | + assert(ret); |
1275 | 1281 | txundo.vprevout.push_back(undo);
|
1276 | 1282 | }
|
1277 | 1283 | }
|
1278 | 1284 |
|
1279 | 1285 | // add outputs
|
1280 |
| - assert(inputs.SetCoins(txhash, CCoins(tx, nHeight))); |
| 1286 | + ret = inputs.SetCoins(txhash, CCoins(tx, nHeight)); |
| 1287 | + assert(ret); |
1281 | 1288 | }
|
1282 | 1289 |
|
1283 | 1290 | bool CScriptCheck::operator()() const {
|
@@ -1651,7 +1658,9 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C
|
1651 | 1658 | return state.Abort(_("Failed to write transaction index"));
|
1652 | 1659 |
|
1653 | 1660 | // add this block to the view's block chain
|
1654 |
| - assert(view.SetBestBlock(pindex->GetBlockHash())); |
| 1661 | + bool ret; |
| 1662 | + ret = view.SetBestBlock(pindex->GetBlockHash()); |
| 1663 | + assert(ret); |
1655 | 1664 |
|
1656 | 1665 | // Watch for transactions paying to me
|
1657 | 1666 | for (unsigned int i = 0; i < block.vtx.size(); i++)
|
@@ -1746,7 +1755,9 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
|
1746 | 1755 | // Flush changes to global coin state
|
1747 | 1756 | int64_t nStart = GetTimeMicros();
|
1748 | 1757 | int nModified = view.GetCacheSize();
|
1749 |
| - assert(view.Flush()); |
| 1758 | + bool ret; |
| 1759 | + ret = view.Flush(); |
| 1760 | + assert(ret); |
1750 | 1761 | int64_t nTime = GetTimeMicros() - nStart;
|
1751 | 1762 | if (fBenchmark)
|
1752 | 1763 | LogPrintf("- Flush %i transactions: %.2fms (%.4fms/tx)\n", nModified, 0.001 * nTime, 0.001 * nTime / nModified);
|
|
0 commit comments