]> Git Repo - VerusCoin.git/commitdiff
Test
authorjl777 <[email protected]>
Fri, 20 Apr 2018 13:55:34 +0000 (16:55 +0300)
committerjl777 <[email protected]>
Fri, 20 Apr 2018 13:55:34 +0000 (16:55 +0300)
src/main.cpp
src/miner.cpp

index 257b133ffde9f46bc3058f2969c48780607ee7ae..e85ca46c37febf31ed217ca34b714a78543ca7a0 100644 (file)
@@ -3544,7 +3544,7 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block)
     BlockMap::iterator miPrev = mapBlockIndex.find(block.hashPrevBlock);
     if (it != mapBlockIndex.end())
     {
-        if ( ASSETCHAINS_STAKED == 0 || it->second != 0 ) // change behavior to allow komodo_ensure to work
+        if ( vNodes.size() < 4 || it->second != 0 ) // change behavior to allow komodo_ensure to work
         {
             // this is the strange case where somehow the hash is in the mapBlockIndex via as yet undetermined process, but the pindex for the hash is not there. Theoretically it is due to processing the block headers, but I have seen it get this case without having received it from the block headers or anywhere else... jl777
             //fprintf(stderr,"addtoblockindex already there %p\n",it->second);
@@ -3754,7 +3754,7 @@ bool CheckBlockHeader(int32_t height,CBlockIndex *pindex, const CBlockHeader& bl
     }
     if (blockhdr.GetBlockTime() > GetAdjustedTime() + 60)
         return state.Invalid(error("CheckBlockHeader(): block timestamp too far in the future"),REJECT_INVALID, "time-too-new");
-    else if ( ASSETCHAINS_STAKED != 0 && pindex != 0 && pindex->pprev != 0 && pindex->nTime <= pindex->pprev->nTime )
+    else if ( ASSETCHAINS_STAKED != 0 && pindex != 0 && pindex->pprev != 0 && pindex->nTime < pindex->pprev->nTime )
     {
         fprintf(stderr,"ht.%d %u vs ht.%d %u, is not monotonic\n",pindex->nHeight,pindex->nTime,pindex->pprev->nHeight,pindex->pprev->nTime);
         return state.Invalid(error("CheckBlockHeader(): block timestamp needs to always increase"),REJECT_INVALID, "time-too-new");
@@ -4155,7 +4155,7 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo
         }
         // Store to disk
         CBlockIndex *pindex = NULL;
-        if ( ASSETCHAINS_STAKED != 0 ) // or other low node count networks
+        if ( vNodes.size() < 4 )
         {
             // 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);
index c2a7bf1fd7ec75d9c31e7c562ad547152252c660..ec40fb44938795eee300eaf8d8ab26f719ee22e6 100644 (file)
@@ -635,8 +635,9 @@ static bool ProcessBlockFound(CBlock* pblock)
         return error("KomodoMiner: ProcessNewBlock, block not accepted");
     
     TrackMinedBlock(pblock->GetHash());
-    if ( ASSETCHAINS_STAKED != 0 )
+    if ( vNodes.size() < 8 )
     {
+        int32_t n = 1;
         //fprintf(stderr,"broadcast new block t.%u\n",(uint32_t)time(NULL));
         {
             LOCK(cs_vNodes);
@@ -644,7 +645,11 @@ static bool ProcessBlockFound(CBlock* pblock)
             {
                 if ( pnode->hSocket == INVALID_SOCKET )
                     continue;
-                pnode->PushMessage("block", *pblock);
+                if ( (rand() % n) == 0 )
+                {
+                    pnode->PushMessage("block", *pblock);
+                    n++;
+                }
             }
         }
         //fprintf(stderr,"finished broadcast new block t.%u\n",(uint32_t)time(NULL));
This page took 0.038644 seconds and 4 git commands to generate.