Remove rand throttle

This commit is contained in:
jl777
2019-07-02 07:14:27 -11:00
parent f016d63e51
commit 9edaca71f4

View File

@@ -162,8 +162,8 @@ void komodo_nSPVresp(CNode *pfrom,std::vector<uint8_t> response) // received a r
switch ( response[0] ) switch ( response[0] )
{ {
case NSPV_INFORESP: case NSPV_INFORESP:
fprintf(stderr,"got info response %u\n",timestamp); // update current height and ntrz status fprintf(stderr,"got info response %u\n",timestamp); // update current height and ntrz status
break; break;
case NSPV_UTXOSRESP: case NSPV_UTXOSRESP:
fprintf(stderr,"got utxos response %u\n",timestamp); // update utxos list fprintf(stderr,"got utxos response %u\n",timestamp); // update utxos list
break; break;
@@ -223,25 +223,19 @@ void komodo_nSPV(CNode *pto)
if ( (pto->nServices & NODE_ADDRINDEX) != 0 && timestamp > pto->lastutxos + ASSETCHAINS_BLOCKTIME ) if ( (pto->nServices & NODE_ADDRINDEX) != 0 && timestamp > pto->lastutxos + ASSETCHAINS_BLOCKTIME )
{ {
// get utxo since lastheight // get utxo since lastheight
if ( (rand() % 100) < 10 ) request.resize(1);
{ request[0] = NSPV_UTXOS;
request.resize(1); NSPV_lastutxos = pto->lastutxos = timestamp;
request[0] = NSPV_UTXOS; pto->PushMessage("getnSPV",request);
NSPV_lastutxos = pto->lastutxos = timestamp;
pto->PushMessage("getnSPV",request);
}
} }
} }
if ( timestamp > NSPV_lastinfo + ASSETCHAINS_BLOCKTIME/2 && timestamp > pto->lastinfo + ASSETCHAINS_BLOCKTIME ) if ( timestamp > NSPV_lastinfo + ASSETCHAINS_BLOCKTIME/2 && timestamp > pto->lastinfo + ASSETCHAINS_BLOCKTIME )
{ {
if ( (rand() % 100) < 20 ) // query current height, blockhash, notarization info
{ request.resize(1);
// query current height, blockhash, notarization info request[0] = NSPV_INFO;
request.resize(1); NSPV_lastinfo = pto->lastinfo = timestamp;
request[0] = NSPV_INFO; pto->PushMessage("getnSPV",request);
NSPV_lastinfo = pto->lastinfo = timestamp;
pto->PushMessage("getnSPV",request);
}
} }
} }