diff --git a/src/komodo_nSPV.h b/src/komodo_nSPV.h index 6ce3d5094..680949b12 100644 --- a/src/komodo_nSPV.h +++ b/src/komodo_nSPV.h @@ -26,9 +26,6 @@ #define NSPV_UTXOS 0x02 #define NSPV_UTXOSRESP 0x03 -uint32_t CNode_lastinfo(CNode *pnode,uint32_t lastutxos); -uint32_t CNode_lastutxos(CNode *pnode,uint32_t lastutxos); - uint32_t NSPV_lastinfo,NSPV_lastutxos; void komodo_nSPVreq(CNode *pfrom,std::vector request) // received a request @@ -39,19 +36,19 @@ void komodo_nSPVreq(CNode *pfrom,std::vector request) // received a req response.resize(1); if ( len == 1 && request[0] == NSPV_INFO ) // info { - if ( timestamp > CNode_lastinfo(pfrom,0) + ASSETCHAINS_BLOCKTIME/2 ) + if ( timestamp > pfrom->lastinfo + ASSETCHAINS_BLOCKTIME/2 ) { response[0] = NSPV_INFORESP; - CNode_lastinfo(pfrom,timestamp); + pfrom->lastinfo = timestamp; pfrom->PushMessage("nSPV",response); } } else if ( request[0] == NSPV_UTXOS ) { - if ( timestamp > CNode_lastutxos(pfrom,0) + ASSETCHAINS_BLOCKTIME/2 ) + if ( timestamp > pfrom->lastutxos + ASSETCHAINS_BLOCKTIME/2 ) { response[0] = NSPV_UTXOSRESP; - CNode_lastutxos(pfrom,timestamp); + pfrom->lastutxos = timestamp; pfrom->PushMessage("nSPV",response); } } @@ -83,29 +80,27 @@ void komodo_nSPV(CNode *pto) // limit frequency! if ( timestamp > NSPV_lastutxos + ASSETCHAINS_BLOCKTIME/2 ) { - if ( (pto->nServices & NODE_ADDRINDEX) != 0 && timestamp > CNode_lastutxos(pto,0) + ASSETCHAINS_BLOCKTIME ) + if ( (pto->nServices & NODE_ADDRINDEX) != 0 && timestamp > ptr->lastutxos + ASSETCHAINS_BLOCKTIME ) { // get utxo since lastheight if ( (rand() % 100) < 10 ) { request.resize(1); request[0] = NSPV_UTXOS; - NSPV_lastutxos = timestamp; - CNode_lastutxos(pto,NSPV_lastutxos); + NSPV_lastutxos = pto->lastutxos = timestamp; pto->PushMessage("getnSPV",request); return; } } } - if ( timestamp > NSPV_lastinfo + ASSETCHAINS_BLOCKTIME/2 && timestamp > CNode_lastinfo(pto,0) + ASSETCHAINS_BLOCKTIME ) + if ( timestamp > NSPV_lastinfo + ASSETCHAINS_BLOCKTIME/2 && timestamp > ptr->lastinfo + ASSETCHAINS_BLOCKTIME ) { if ( (rand() % 100) < 10 ) { // query current height, blockhash, notarization info request.resize(1); request[0] = NSPV_INFO; - NSPV_lastinfo = timestamp; - CNode_lastinfo(pto,NSPV_lastinfo); + NSPV_lastinfo = pto->lastinfo = timestamp; pto->PushMessage("getnSPV",request); } } diff --git a/src/net.cpp b/src/net.cpp index f82e69e9d..5806489a8 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -682,25 +682,6 @@ int CNetMessage::readData(const char *pch, unsigned int nBytes) - - -uint32_t CNode_lastutxos(CNode *pnode,uint32_t lastutxos) -{ - uint32_t prev = pnode->lastutxos; - if ( lastutxos != 0 ) - pnode->lastutxos = lastutxos; - return(prev); -} - -uint32_t CNode_lastinfo(CNode *pnode,uint32_t lastinfo) -{ - uint32_t prev = pnode->lastinfo; - if ( lastinfo != 0 ) - pnode->lastinfo = lastinfo; - return(prev); -} - - // requires LOCK(cs_vSend) void SocketSendData(CNode *pnode) { diff --git a/src/net.h b/src/net.h index fbe756c85..c50d31f6a 100644 --- a/src/net.h +++ b/src/net.h @@ -204,7 +204,6 @@ public: bool fWhitelisted; double dPingTime; double dPingWait; - uint32_t lastutxos,lastinfo; std::string addrLocal; }; @@ -277,6 +276,7 @@ public: int64_t nLastRecv; int64_t nTimeConnected; int64_t nTimeOffset; + uint32_t lastutxos,lastinfo; CAddress addr; std::string addrName; CService addrLocal;