@ -27,6 +27,10 @@
@@ -27,6 +27,10 @@
using namespace std ;
using namespace boost ;
# if defined(NDEBUG)
# error "Bitcoin cannot be compiled without assertions."
# endif
//
// Global state
//
@ -1266,18 +1270,21 @@ void UpdateTime(CBlockHeader& block, const CBlockIndex* pindexPrev)
@@ -1266,18 +1270,21 @@ void UpdateTime(CBlockHeader& block, const CBlockIndex* pindexPrev)
void UpdateCoins ( const CTransaction & tx , CValidationState & state , CCoinsViewCache & inputs , CTxUndo & txundo , int nHeight , const uint256 & txhash )
{
bool ret ;
// mark inputs spent
if ( ! tx . IsCoinBase ( ) ) {
BOOST_FOREACH ( const CTxIn & txin , tx . vin ) {
CCoins & coins = inputs . GetCoins ( txin . prevout . hash ) ;
CTxInUndo undo ;
assert ( coins . Spend ( txin . prevout , undo ) ) ;
ret = coins . Spend ( txin . prevout , undo ) ;
assert ( ret ) ;
txundo . vprevout . push_back ( undo ) ;
}
}
// add outputs
assert ( inputs . SetCoins ( txhash , CCoins ( tx , nHeight ) ) ) ;
ret = inputs . SetCoins ( txhash , CCoins ( tx , nHeight ) ) ;
assert ( ret ) ;
}
bool CScriptCheck : : operator ( ) ( ) const {
@ -1651,7 +1658,9 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C
@@ -1651,7 +1658,9 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C
return state . Abort ( _ ( " Failed to write transaction index " ) ) ;
// add this block to the view's block chain
assert ( view . SetBestBlock ( pindex - > GetBlockHash ( ) ) ) ;
bool ret ;
ret = view . SetBestBlock ( pindex - > GetBlockHash ( ) ) ;
assert ( ret ) ;
// Watch for transactions paying to me
for ( unsigned int i = 0 ; i < block . vtx . size ( ) ; i + + )
@ -1746,7 +1755,9 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
@@ -1746,7 +1755,9 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
// Flush changes to global coin state
int64_t nStart = GetTimeMicros ( ) ;
int nModified = view . GetCacheSize ( ) ;
assert ( view . Flush ( ) ) ;
bool ret ;
ret = view . Flush ( ) ;
assert ( ret ) ;
int64_t nTime = GetTimeMicros ( ) - nStart ;
if ( fBenchmark )
LogPrintf ( " - Flush %i transactions: %.2fms (%.4fms/tx) \n " , nModified , 0.001 * nTime , 0.001 * nTime / nModified ) ;