From 857c644fadddc4db4a86525001c1b7433b1f5dd2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 24 Apr 2018 22:46:23 +0300 Subject: [PATCH 01/14] Auto set index --- src/main.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 6ba882d2e..8046ec64c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4104,14 +4104,18 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C { if ( *futureblockp == 0 ) { - LogPrintf("AcceptBlock AcceptBlockHeader error"); + LogPrintf("AcceptBlock AcceptBlockHeader error\n"); return false; } } if ( pindex == 0 ) { - LogPrintf("AcceptBlock null pindex error"); - return false; + *ppindex = pindex = AddToBlockIndex(block); + if ( pindex == 0 ) + { + LogPrintf("AcceptBlock null pindex error\n"); + return false; + } } //fprintf(stderr,"acceptblockheader passed\n"); // Try to process all requested blocks that we don't have, but only @@ -4174,7 +4178,7 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C FlushStateToDisk(state, FLUSH_STATE_NONE); // we just allocated more disk space for block files if ( *futureblockp == 0 ) return true; - LogPrintf("AcceptBlock block from future error"); + LogPrintf("AcceptBlock block from future error\n"); return false; } @@ -4203,7 +4207,7 @@ CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash) miSelf->second = AddToBlockIndex(*pblock); //fprintf(stderr,"Block header %s is already known, but without pindex -> ensured %p\n",hash.ToString().c_str(),miSelf->second); } - /*if ( hash != chainparams.GetConsensus().hashGenesisBlock ) + if ( hash != chainparams.GetConsensus().hashGenesisBlock ) { miSelf = mapBlockIndex.find(pblock->hashPrevBlock); if ( miSelf == mapBlockIndex.end() ) @@ -4211,7 +4215,7 @@ CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash) miSelf->second = InsertBlockIndex(pblock->hashPrevBlock); fprintf(stderr,"autocreate previndex %s\n",pblock->hashPrevBlock.ToString().c_str()); } - }*/ + } } } From b1af3ff1653739e9ef18361208fb75a9ec7e9f7d Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 24 Apr 2018 22:47:45 +0300 Subject: [PATCH 02/14] Test --- src/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 8046ec64c..7878970a7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4034,7 +4034,7 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat { if ( *futureblockp == 0 ) { - LogPrintf("AcceptBlockHeader CheckBlockHeader error"); + LogPrintf("AcceptBlockHeader CheckBlockHeader error\n"); return false; } } @@ -4051,7 +4051,7 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat komodo_requestedhash = block.hashPrevBlock; komodo_requestedcount = 0; }*/ - LogPrintf("AcceptBlockHeader hashPrevBlock %s not found",block.hashPrevBlock.ToString().c_str()); + LogPrintf("AcceptBlockHeader hashPrevBlock %s not found\n",block.hashPrevBlock.ToString().c_str()); return(false); //return state.DoS(10, error("%s: prev block not found", __func__), 0, "bad-prevblk"); } @@ -4064,7 +4064,7 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat komodo_requestedhash = block.hashPrevBlock; komodo_requestedcount = 0; }*/ - LogPrintf("AcceptBlockHeader hashPrevBlock %s no pindexPrev",block.hashPrevBlock.ToString().c_str()); + LogPrintf("AcceptBlockHeader hashPrevBlock %s no pindexPrev\n",block.hashPrevBlock.ToString().c_str()); return(false); } if ( (pindexPrev->nStatus & BLOCK_FAILED_MASK) ) @@ -4073,7 +4073,7 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat if (!ContextualCheckBlockHeader(block, state, pindexPrev)) { //fprintf(stderr,"AcceptBlockHeader ContextualCheckBlockHeader failed\n"); - LogPrintf("AcceptBlockHeader ContextualCheckBlockHeader failed"); + LogPrintf("AcceptBlockHeader ContextualCheckBlockHeader failed\n"); return false; } if (pindex == NULL) @@ -4150,7 +4150,7 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C pindex->nStatus |= BLOCK_FAILED_VALID; setDirtyBlockIndex.insert(pindex); } - LogPrintf("AcceptBlock CheckBlock or ContextualCheckBlock error"); + LogPrintf("AcceptBlock CheckBlock or ContextualCheckBlock error\n"); return false; } } From 169abf82c5efe290d7d94e1b056df31b77f86caa Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 24 Apr 2018 22:53:46 +0300 Subject: [PATCH 03/14] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 7878970a7..6d225faa8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4207,7 +4207,7 @@ CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash) miSelf->second = AddToBlockIndex(*pblock); //fprintf(stderr,"Block header %s is already known, but without pindex -> ensured %p\n",hash.ToString().c_str(),miSelf->second); } - if ( hash != chainparams.GetConsensus().hashGenesisBlock ) + if ( hash != Params().GetConsensus().hashGenesisBlock ) { miSelf = mapBlockIndex.find(pblock->hashPrevBlock); if ( miSelf == mapBlockIndex.end() ) From b571143669dee70248c952e24b543916d3491830 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Apr 2018 00:01:34 +0300 Subject: [PATCH 04/14] Update komodo_ensure --- src/main.cpp | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 6d225faa8..ca7f8517a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4110,12 +4110,8 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C } if ( pindex == 0 ) { - *ppindex = pindex = AddToBlockIndex(block); - if ( pindex == 0 ) - { - LogPrintf("AcceptBlock null pindex error\n"); - return false; - } + LogPrintf("AcceptBlock null pindex error\n"); + return false; } //fprintf(stderr,"acceptblockheader passed\n"); // Try to process all requested blocks that we don't have, but only @@ -4198,25 +4194,45 @@ void komodo_currentheight_set(int32_t height); CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash) { - CBlockIndex *pindex; + CBlockIndex *pindex=0,*previndex=0; BlockMap::iterator miSelf = mapBlockIndex.find(hash); - if ( miSelf != mapBlockIndex.end() ) + if ( miSelf == mapBlockIndex.end() ) { - if ( (pindex= miSelf->second) == 0 ) // create pindex so first Accept block doesnt fail + pindex = InsertBlockIndex(hash); + LogPrintf("autocreate pindex %s\n",hash.ToString().c_str()); + } + if ( (miSelf= mapBlockIndex.find(hash)) != mapBlockIndex.end() ) + { + if ( miSelf->second == 0 ) // create pindex so first Accept block doesnt fail { - miSelf->second = AddToBlockIndex(*pblock); - //fprintf(stderr,"Block header %s is already known, but without pindex -> ensured %p\n",hash.ToString().c_str(),miSelf->second); + if ( pindex == 0 ) + pindex = AddToBlockIndex(*pblock); + if ( pindex != 0 ) + { + miSelf->second = pindex; + LogPrintf("Block header %s is already known, but without pindex -> ensured %p\n",hash.ToString().c_str(),miSelf->second); + } else LogPrintf("komodo_ensure unexpected null pindex\n"); } if ( hash != Params().GetConsensus().hashGenesisBlock ) { miSelf = mapBlockIndex.find(pblock->hashPrevBlock); if ( miSelf == mapBlockIndex.end() ) + previndex = InsertBlockIndex(pblock->hashPrevBlock); + if ( (miSelf= mapBlockIndex.find(pblock->hashPrevBlock)) != mapBlockIndex.end() ) { - miSelf->second = InsertBlockIndex(pblock->hashPrevBlock); - fprintf(stderr,"autocreate previndex %s\n",pblock->hashPrevBlock.ToString().c_str()); - } + if ( miSelf->second == 0 ) // create pindex so first Accept block doesnt fail + { + if ( previndex == 0 ) + previndex = InsertBlockIndex(pblock->hashPrevBlock); + if ( previndex != 0 ) + { + miSelf->second = previndex; + LogPrintf("autocreate previndex %s\n",pblock->hashPrevBlock.ToString().c_str()); + } else LogPrintf("komodo_ensure unexpected null previndex\n"); + } + } else LogPrintf("komodo_ensure unexpected null miprev\n"); } - } + } else LogPrintf("komodo_ensure unexpected error creating pindex %s\n",hash.ToString().c_str()); } bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNode* pfrom, CBlock* pblock, bool fForceProcessing, CDiskBlockPos *dbp) From 5d214ce738f1c0d29ed36fdb67c149c8313d1d0e Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Apr 2018 00:24:07 +0300 Subject: [PATCH 05/14] New approach for komodo_ensure --- src/main.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ca7f8517a..ee418a022 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3561,7 +3561,7 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block) } if ( miPrev != mapBlockIndex.end() && (*miPrev).second == 0 ) { - //fprintf(stderr,"edge case of both block and prevblock in the strange state\n"); + fprintf(stderr,"edge case of both block and prevblock in the strange state\n"); return(0); // return here to avoid the state of pindex->nHeight not set and pprev NULL } } @@ -4195,25 +4195,25 @@ void komodo_currentheight_set(int32_t height); CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash) { CBlockIndex *pindex=0,*previndex=0; + if ( (pindex= mapBlockIndex[hash]) == 0 ) + pindex = InsertBlockIndex(hash); BlockMap::iterator miSelf = mapBlockIndex.find(hash); if ( miSelf == mapBlockIndex.end() ) { - pindex = InsertBlockIndex(hash); - LogPrintf("autocreate pindex %s\n",hash.ToString().c_str()); + LogPrintf("komodo_ensure unexpected missing hash %s\n",hash.ToString().c_str()); + return(0); } - if ( (miSelf= mapBlockIndex.find(hash)) != mapBlockIndex.end() ) + if ( miSelf->second == 0 ) // create pindex so first Accept block doesnt fail { - if ( miSelf->second == 0 ) // create pindex so first Accept block doesnt fail + if ( pindex == 0 ) + pindex = AddToBlockIndex(*pblock); + if ( pindex != 0 ) { - if ( pindex == 0 ) - pindex = AddToBlockIndex(*pblock); - if ( pindex != 0 ) - { - miSelf->second = pindex; - LogPrintf("Block header %s is already known, but without pindex -> ensured %p\n",hash.ToString().c_str(),miSelf->second); - } else LogPrintf("komodo_ensure unexpected null pindex\n"); - } - if ( hash != Params().GetConsensus().hashGenesisBlock ) + miSelf->second = pindex; + LogPrintf("Block header %s is already known, but without pindex -> ensured %p\n",hash.ToString().c_str(),miSelf->second); + } else LogPrintf("komodo_ensure unexpected null pindex\n"); + } + /*if ( hash != Params().GetConsensus().hashGenesisBlock ) { miSelf = mapBlockIndex.find(pblock->hashPrevBlock); if ( miSelf == mapBlockIndex.end() ) @@ -4232,7 +4232,8 @@ CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash) } } else LogPrintf("komodo_ensure unexpected null miprev\n"); } - } else LogPrintf("komodo_ensure unexpected error creating pindex %s\n",hash.ToString().c_str()); + }*/ + return(pindex); } bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNode* pfrom, CBlock* pblock, bool fForceProcessing, CDiskBlockPos *dbp) From d1c9d1b49281c201674abe5c6184182787afdf08 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Apr 2018 00:45:38 +0300 Subject: [PATCH 06/14] Test --- src/main.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index ee418a022..81e5ee1c9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4196,7 +4196,13 @@ CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash) { CBlockIndex *pindex=0,*previndex=0; if ( (pindex= mapBlockIndex[hash]) == 0 ) - pindex = InsertBlockIndex(hash); + { + pindex = new CBlockIndex(); + if (!pindex) + throw runtime_error("komodo_ensure: new CBlockIndex failed"); + BlockMap::iterator mi = mapBlockIndex.insert(make_pair(hash, pindex)).first; + pindex->phashBlock = &((*mi).first); + } BlockMap::iterator miSelf = mapBlockIndex.find(hash); if ( miSelf == mapBlockIndex.end() ) { @@ -4206,7 +4212,10 @@ CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash) if ( miSelf->second == 0 ) // create pindex so first Accept block doesnt fail { if ( pindex == 0 ) + { pindex = AddToBlockIndex(*pblock); + fprintf(stderr,"ensure call addtoblockindex, got %p\n",pindex); + } if ( pindex != 0 ) { miSelf->second = pindex; From 4270df91a344352c54de70e67d1a492aeb6690ca Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Apr 2018 01:01:26 +0300 Subject: [PATCH 07/14] -ensure --- src/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.cpp b/src/main.cpp index 81e5ee1c9..3d1b289bf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4274,6 +4274,7 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo } // Store to disk CBlockIndex *pindex = NULL; + if ( 0 ) { // without the komodo_ensure call, it is quite possible to get a non-error but null pindex returned from AcceptBlockHeader. In a 2 node network, it will be a long time before that block is reprocessed. Even though restarting makes it rescan, it seems much better to keep the nodes in sync komodo_ensure(pblock,hash); From 55c01f138dd9309bbba6039baefdcab5bc6d7088 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Apr 2018 01:14:19 +0300 Subject: [PATCH 08/14] Audo addtoblockindex --- src/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 3d1b289bf..cdafada5e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4015,7 +4015,8 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat if (miSelf != mapBlockIndex.end()) { // Block header is already known. - pindex = miSelf->second; + if ( (pindex= miSelf->second) == 0 ) + pindex = AddToBlockIndex(block); if (ppindex) *ppindex = pindex; if ( pindex != 0 && pindex->nStatus & BLOCK_FAILED_MASK ) @@ -4026,6 +4027,7 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat memset(&komodo_requestedhash,0,sizeof(komodo_requestedhash)); komodo_requestedcount = 0; }*/ + //if ( pindex == 0 ) // fprintf(stderr,"accepthdr %s already known but no pindex\n",hash.ToString().c_str()); return true; From 163fbf95a1768ae93867204bc8b11dd48dc1f324 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Apr 2018 01:29:00 +0300 Subject: [PATCH 09/14] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index cdafada5e..a6d2fee8f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4276,7 +4276,7 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo } // Store to disk CBlockIndex *pindex = NULL; - if ( 0 ) + if ( 1 ) { // without the komodo_ensure call, it is quite possible to get a non-error but null pindex returned from AcceptBlockHeader. In a 2 node network, it will be a long time before that block is reprocessed. Even though restarting makes it rescan, it seems much better to keep the nodes in sync komodo_ensure(pblock,hash); From 4ac854ea908bb5446b0713df1e8467f527d08bab Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Apr 2018 01:37:43 +0300 Subject: [PATCH 10/14] Simplify ensure --- src/main.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index a6d2fee8f..250a72f72 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4195,6 +4195,32 @@ static bool IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned void komodo_currentheight_set(int32_t height); CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash) +{ + CBlockIndex *pindex; + BlockMap::iterator miSelf = mapBlockIndex.find(hash); + if ( miSelf != mapBlockIndex.end() ) + { + if ( (pindex= miSelf->second) == 0 ) // create pindex so first Accept block doesnt fail + { + miSelf->second = AddToBlockIndex(*pblock); + //fprintf(stderr,"Block header %s is already known, but without pindex -> ensured %p\n",hash.ToString().c_str(),miSelf->second); + } + if ( hash != Params.GetConsensus().hashGenesisBlock ) + { + miSelf = mapBlockIndex.find(pblock->hashPrevBlock); + if ( miSelf != mapBlockIndex.end() ) + { + if ( miSelf->second == 0 ) + { + miSelf->second = InsertBlockIndex(pblock->hashPrevBlock); + fprintf(stderr,"autocreate previndex %s\n",pblock->hashPrevBlock.ToString().c_str()); + } + } + } + } +} + +CBlockIndex *oldkomodo_ensure(CBlock *pblock,uint256 hash) { CBlockIndex *pindex=0,*previndex=0; if ( (pindex= mapBlockIndex[hash]) == 0 ) From 85328429bb72a4ec378bf592971046dddbd8b075 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Apr 2018 01:41:44 +0300 Subject: [PATCH 11/14] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 250a72f72..f0a2c1e0e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4205,7 +4205,7 @@ CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash) miSelf->second = AddToBlockIndex(*pblock); //fprintf(stderr,"Block header %s is already known, but without pindex -> ensured %p\n",hash.ToString().c_str(),miSelf->second); } - if ( hash != Params.GetConsensus().hashGenesisBlock ) + if ( hash != Params().GetConsensus().hashGenesisBlock ) { miSelf = mapBlockIndex.find(pblock->hashPrevBlock); if ( miSelf != mapBlockIndex.end() ) From 58ef04c7dc617e2740fff57da05ea5b934a273c9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Apr 2018 02:28:14 +0300 Subject: [PATCH 12/14] Set mi->second --- src/main.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f0a2c1e0e..6d2198d4e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3588,6 +3588,7 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block) setDirtyBlockIndex.insert(pindexNew); //fprintf(stderr,"added to block index %s %p\n",hash.ToString().c_str(),pindexNew); + it->second = pindexNew; return pindexNew; } @@ -4016,7 +4017,7 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat { // Block header is already known. if ( (pindex= miSelf->second) == 0 ) - pindex = AddToBlockIndex(block); + miSelf->second = pindex = AddToBlockIndex(block); if (ppindex) *ppindex = pindex; if ( pindex != 0 && pindex->nStatus & BLOCK_FAILED_MASK ) @@ -4080,8 +4081,11 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat } if (pindex == NULL) { - if ( (pindex= AddToBlockIndex(block)) == 0 ) + if ( (pindex= AddToBlockIndex(block)) != 0 ) { + miSelf = mapBlockIndex.find(hash); + if (miSelf != mapBlockIndex.end()) + miSelf->second = pindex; //fprintf(stderr,"AcceptBlockHeader couldnt add to block index\n"); } } @@ -4196,7 +4200,7 @@ void komodo_currentheight_set(int32_t height); CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash) { - CBlockIndex *pindex; + CBlockIndex *pindex = 0; BlockMap::iterator miSelf = mapBlockIndex.find(hash); if ( miSelf != mapBlockIndex.end() ) { @@ -4205,7 +4209,7 @@ CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash) miSelf->second = AddToBlockIndex(*pblock); //fprintf(stderr,"Block header %s is already known, but without pindex -> ensured %p\n",hash.ToString().c_str(),miSelf->second); } - if ( hash != Params().GetConsensus().hashGenesisBlock ) + /*if ( hash != Params().GetConsensus().hashGenesisBlock ) { miSelf = mapBlockIndex.find(pblock->hashPrevBlock); if ( miSelf != mapBlockIndex.end() ) @@ -4216,8 +4220,9 @@ CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash) fprintf(stderr,"autocreate previndex %s\n",pblock->hashPrevBlock.ToString().c_str()); } } - } + }*/ } + return(pindex); } CBlockIndex *oldkomodo_ensure(CBlock *pblock,uint256 hash) From 9cdde30c2c3cbc0a20debf9e7fba51f0150a98ef Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Apr 2018 02:32:14 +0300 Subject: [PATCH 13/14] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 6d2198d4e..886d9eef2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3588,7 +3588,7 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block) setDirtyBlockIndex.insert(pindexNew); //fprintf(stderr,"added to block index %s %p\n",hash.ToString().c_str(),pindexNew); - it->second = pindexNew; + mi->second = pindexNew; return pindexNew; } From f190f354b0ed0d4e36d9a8eebfc9b9bcbbc2f9d3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 Apr 2018 02:51:17 +0300 Subject: [PATCH 14/14] -print --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 886d9eef2..515833651 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3561,7 +3561,7 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block) } if ( miPrev != mapBlockIndex.end() && (*miPrev).second == 0 ) { - fprintf(stderr,"edge case of both block and prevblock in the strange state\n"); + //fprintf(stderr,"edge case of both block and prevblock in the strange state\n"); return(0); // return here to avoid the state of pindex->nHeight not set and pprev NULL } }