Test
This commit is contained in:
@@ -56,6 +56,7 @@ extern uint8_t NOTARY_PUBKEY33[33];
|
||||
extern int32_t KOMODO_LOADINGBLOCKS,KOMODO_LONGESTCHAIN;
|
||||
int32_t KOMODO_NEWBLOCKS;
|
||||
int32_t komodo_block2pubkey33(uint8_t *pubkey33,CBlock *block);
|
||||
void komodo_broadcast(CBlock *pblock,int32_t limit);
|
||||
|
||||
BlockMap mapBlockIndex;
|
||||
CChain chainActive;
|
||||
@@ -3218,6 +3219,8 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
|
||||
int64_t nTime6 = GetTimeMicros(); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1;
|
||||
LogPrint("bench", " - Connect postprocess: %.2fms [%.2fs]\n", (nTime6 - nTime5) * 0.001, nTimePostConnect * 0.000001);
|
||||
LogPrint("bench", "- Connect block: %.2fms [%.2fs]\n", (nTime6 - nTime1) * 0.001, nTimeTotal * 0.000001);
|
||||
if ( ASSETHCHAINS_SYMBOL[0] == 0 )
|
||||
komodo_broadcast(pblock,8);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ static const unsigned int MAX_HEADERS_RESULTS = 160;
|
||||
* Larger windows tolerate larger download speed differences between peer, but increase the potential
|
||||
* degree of disordering of blocks on disk (which make reindexing and in the future perhaps pruning
|
||||
* harder). We'll probably want to make this a per-peer adaptive value at some point. */
|
||||
static const unsigned int BLOCK_DOWNLOAD_WINDOW = 1024 * 2;
|
||||
static const unsigned int BLOCK_DOWNLOAD_WINDOW = 1024;
|
||||
/** Time to wait (in seconds) between writing blocks/block index to disk. */
|
||||
static const unsigned int DATABASE_WRITE_INTERVAL = 60 * 60;
|
||||
/** Time to wait (in seconds) between flushing chainstate to disk. */
|
||||
|
||||
@@ -584,6 +584,26 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
|
||||
return CreateNewBlock(scriptPubKey);
|
||||
}
|
||||
|
||||
void komodo_broadcast(CBlock *pblock,int32_t limit)
|
||||
{
|
||||
int32_t n = 1;
|
||||
//fprintf(stderr,"broadcast new block t.%u\n",(uint32_t)time(NULL));
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||
{
|
||||
if ( pnode->hSocket == INVALID_SOCKET )
|
||||
continue;
|
||||
if ( (rand() % n) == 0 )
|
||||
{
|
||||
pnode->PushMessage("block", *pblock);
|
||||
if ( n++ > limit )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//fprintf(stderr,"finished broadcast new block t.%u\n",(uint32_t)time(NULL));
|
||||
}
|
||||
|
||||
static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey)
|
||||
#else
|
||||
@@ -635,26 +655,7 @@ static bool ProcessBlockFound(CBlock* pblock)
|
||||
return error("KomodoMiner: ProcessNewBlock, block not accepted");
|
||||
|
||||
TrackMinedBlock(pblock->GetHash());
|
||||
//if ( vNodes.size() < KOMODO_LIMITED_NETWORKSIZE*2 )
|
||||
{
|
||||
int32_t n = 1;
|
||||
//fprintf(stderr,"broadcast new block t.%u\n",(uint32_t)time(NULL));
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||
{
|
||||
if ( pnode->hSocket == INVALID_SOCKET )
|
||||
continue;
|
||||
if ( (rand() % n) == 0 )
|
||||
{
|
||||
pnode->PushMessage("block", *pblock);
|
||||
if ( n++ > 8 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//fprintf(stderr,"finished broadcast new block t.%u\n",(uint32_t)time(NULL));
|
||||
}
|
||||
komodo_broadcast(pblock,16);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user