Skip nonvolatile

This commit is contained in:
jl777
2019-07-02 02:32:01 -11:00
parent 6d09975752
commit 4d6cd8f0b4

View File

@@ -4243,13 +4243,17 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
mapBlockSource.erase(pindexNew->GetBlockHash()); mapBlockSource.erase(pindexNew->GetBlockHash());
nTime3 = GetTimeMicros(); nTimeConnectTotal += nTime3 - nTime2; nTime3 = GetTimeMicros(); nTimeConnectTotal += nTime3 - nTime2;
LogPrint("bench", " - Connect total: %.2fms [%.2fs]\n", (nTime3 - nTime2) * 0.001, nTimeConnectTotal * 0.000001); LogPrint("bench", " - Connect total: %.2fms [%.2fs]\n", (nTime3 - nTime2) * 0.001, nTimeConnectTotal * 0.000001);
assert(view.Flush()); if ( KOMODO_NSPV == 0 )
assert(view.Flush());
} }
int64_t nTime4 = GetTimeMicros(); nTimeFlush += nTime4 - nTime3; int64_t nTime4 = GetTimeMicros(); nTimeFlush += nTime4 - nTime3;
LogPrint("bench", " - Flush: %.2fms [%.2fs]\n", (nTime4 - nTime3) * 0.001, nTimeFlush * 0.000001); LogPrint("bench", " - Flush: %.2fms [%.2fs]\n", (nTime4 - nTime3) * 0.001, nTimeFlush * 0.000001);
// Write the chain state to disk, if necessary. // Write the chain state to disk, if necessary.
if (!FlushStateToDisk(state, FLUSH_STATE_IF_NEEDED)) if ( KOMODO_NSPV == 0 )
return false; {
if (!FlushStateToDisk(state, FLUSH_STATE_IF_NEEDED))
return false;
}
int64_t nTime5 = GetTimeMicros(); nTimeChainState += nTime5 - nTime4; int64_t nTime5 = GetTimeMicros(); nTimeChainState += nTime5 - nTime4;
LogPrint("bench", " - Writing chainstate: %.2fms [%.2fs]\n", (nTime5 - nTime4) * 0.001, nTimeChainState * 0.000001); LogPrint("bench", " - Writing chainstate: %.2fms [%.2fs]\n", (nTime5 - nTime4) * 0.001, nTimeChainState * 0.000001);
// Remove conflicting transactions from the mempool. // Remove conflicting transactions from the mempool.
@@ -4261,14 +4265,17 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
// Update chainActive & related variables. // Update chainActive & related variables.
UpdateTip(pindexNew); UpdateTip(pindexNew);
// Tell wallet about transactions that went from mempool if ( KOMODO_NSPV == 0 )
// to conflicted: {
BOOST_FOREACH(const CTransaction &tx, txConflicted) { // Tell wallet about transactions that went from mempool
SyncWithWallets(tx, NULL); // to conflicted:
} BOOST_FOREACH(const CTransaction &tx, txConflicted) {
// ... and about transactions that got confirmed: SyncWithWallets(tx, NULL);
BOOST_FOREACH(const CTransaction &tx, pblock->vtx) { }
SyncWithWallets(tx, pblock); // ... and about transactions that got confirmed:
BOOST_FOREACH(const CTransaction &tx, pblock->vtx) {
SyncWithWallets(tx, pblock);
}
} }
// Update cached incremental witnesses // Update cached incremental witnesses
GetMainSignals().ChainTip(pindexNew, pblock, oldSproutTree, oldSaplingTree, true); GetMainSignals().ChainTip(pindexNew, pblock, oldSproutTree, oldSaplingTree, true);
@@ -4286,19 +4293,22 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
komodo_broadcast(pblock,8); komodo_broadcast(pblock,8);
else if ( ASSETCHAINS_SYMBOL[0] != 0 ) else if ( ASSETCHAINS_SYMBOL[0] != 0 )
komodo_broadcast(pblock,4);*/ komodo_broadcast(pblock,4);*/
if ( ASSETCHAINS_CBOPRET != 0 ) if ( KOMODO_NSPV == 0 )
komodo_pricesupdate(pindexNew->GetHeight(),pblock);
if ( ASSETCHAINS_SAPLING <= 0 && pindexNew->nTime > KOMODO_SAPLING_ACTIVATION - 24*3600 )
komodo_activate_sapling(pindexNew);
if ( ASSETCHAINS_CC != 0 && KOMODO_SNAPSHOT_INTERVAL != 0 && (pindexNew->GetHeight() % KOMODO_SNAPSHOT_INTERVAL) == 0 && pindexNew->GetHeight() >= KOMODO_SNAPSHOT_INTERVAL )
{ {
uint64_t start = time(NULL); if ( ASSETCHAINS_CBOPRET != 0 )
if ( !komodo_dailysnapshot(pindexNew->GetHeight()) ) komodo_pricesupdate(pindexNew->GetHeight(),pblock);
if ( ASSETCHAINS_SAPLING <= 0 && pindexNew->nTime > KOMODO_SAPLING_ACTIVATION - 24*3600 )
komodo_activate_sapling(pindexNew);
if ( ASSETCHAINS_CC != 0 && KOMODO_SNAPSHOT_INTERVAL != 0 && (pindexNew->GetHeight() % KOMODO_SNAPSHOT_INTERVAL) == 0 && pindexNew->GetHeight() >= KOMODO_SNAPSHOT_INTERVAL )
{ {
fprintf(stderr, "daily snapshot failed, please reindex your chain\n"); uint64_t start = time(NULL);
StartShutdown(); if ( !komodo_dailysnapshot(pindexNew->GetHeight()) )
{
fprintf(stderr, "daily snapshot failed, please reindex your chain\n");
StartShutdown();
}
fprintf(stderr, "snapshot completed in: %lu seconds\n", time(NULL)-start);
} }
fprintf(stderr, "snapshot completed in: %lu seconds\n", time(NULL)-start);
} }
return true; return true;
} }