Fix ConnectTip() from thread_notify merge

This commit is contained in:
Duke Leto
2020-03-09 11:04:36 -04:00
parent 9c4acae5fd
commit ad4d87c653

View File

@@ -4157,8 +4157,8 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
assert(pindexNew->pprev == chainActive.Tip()); assert(pindexNew->pprev == chainActive.Tip());
// Read block from disk. // Read block from disk.
int64_t nTime1 = GetTimeMicros(); int64_t nTime1 = GetTimeMicros();
CBlock block;
if (!pblock) { if (!pblock) {
CBlock block;
if (!ReadBlockFromDisk(block, pindexNew,1)) if (!ReadBlockFromDisk(block, pindexNew,1))
return AbortNode(state, "Failed to read block"); return AbortNode(state, "Failed to read block");
pblock = █ pblock = █
@@ -4203,6 +4203,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
} }
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.
std::list<CTransaction> txConflicted; std::list<CTransaction> txConflicted;
mempool.removeForBlock(pblock->vtx, pindexNew->GetHeight(), txConflicted, !IsInitialBlockDownload()); mempool.removeForBlock(pblock->vtx, pindexNew->GetHeight(), txConflicted, !IsInitialBlockDownload());
@@ -4212,8 +4213,6 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
// Update chainActive & related variables. // Update chainActive & related variables.
UpdateTip(pindexNew); UpdateTip(pindexNew);
if ( KOMODO_NSPV_FULLNODE )
{
// Cache the conflicted transactions for subsequent notification. // Cache the conflicted transactions for subsequent notification.
// Updates to connected wallets are triggered by ThreadNotifyWallets // Updates to connected wallets are triggered by ThreadNotifyWallets
@@ -4254,7 +4253,6 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
//fprintf(stderr,"%s: returning true\n", __FUNCTION__); //fprintf(stderr,"%s: returning true\n", __FUNCTION__);
return true; return true;
} }
}
std::pair<std::map<CBlockIndex*, std::list<CTransaction>>, uint64_t> DrainRecentlyConflicted() std::pair<std::map<CBlockIndex*, std::list<CTransaction>>, uint64_t> DrainRecentlyConflicted()
{ {
uint64_t recentlyConflictedSequence; uint64_t recentlyConflictedSequence;