Stub messages
This commit is contained in:
@@ -1067,7 +1067,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
if ( KOMODO_NSPV != 0 )
|
if ( KOMODO_NSPV != 0 )
|
||||||
{
|
{
|
||||||
fDisableWallet = true;
|
fDisableWallet = true;
|
||||||
nLocalServices &= ~NODE_NETWORK;
|
nLocalServices = 0;
|
||||||
}
|
}
|
||||||
if (!fDisableWallet)
|
if (!fDisableWallet)
|
||||||
RegisterWalletRPCCommands(tableRPC);
|
RegisterWalletRPCCommands(tableRPC);
|
||||||
|
|||||||
@@ -21,37 +21,68 @@
|
|||||||
#ifndef KOMODO_NSPV_H
|
#ifndef KOMODO_NSPV_H
|
||||||
#define KOMODO_NSPV_H
|
#define KOMODO_NSPV_H
|
||||||
|
|
||||||
void komodo_nSPVreq(CNode *pfrom,std::vector<uint8_t> payload) // received a request
|
#define NSPV_INFO 0x00
|
||||||
{
|
#define NSPV_INFORESP 0x01
|
||||||
|
#define NSPV_UTXOS 0x02
|
||||||
}
|
#define NSPV_UTXOSRESP 0x03
|
||||||
|
|
||||||
void komodo_nSPVresp(CNode *pfrom,std::vector<uint8_t> payload) // received a response
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*void komodo_sendnSPV(int32_t minpeers,int32_t maxpeers,const char *message,std::vector<uint8_t> payload)
|
void komodo_nSPVreq(CNode *pfrom,std::vector<uint8_t> request) // received a request
|
||||||
{
|
{
|
||||||
int32_t numsent = 0;
|
int32_t len; std::vector<uint8_t> response;
|
||||||
LOCK(cs_vNodes);
|
if ( (len= request.size()) > 0 )
|
||||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
|
||||||
{
|
{
|
||||||
if ( pnode->hSocket == INVALID_SOCKET )
|
response.resize(1);
|
||||||
continue;
|
if ( len == 1 && request[0] == NSPV_INFO ) // info
|
||||||
if ( numsent < minpeers || (rand() % 10) == 0 )
|
|
||||||
{
|
{
|
||||||
//fprintf(stderr,"pushmessage\n");
|
response[0] = NSPV_INFORESP;
|
||||||
pnode->PushMessage(message,payload);
|
pnode->PushMessage("nSPV",response);
|
||||||
if ( numsent++ > maxpeers )
|
}
|
||||||
|
else if ( request[0] == NSPV_UTXOS )
|
||||||
|
{
|
||||||
|
response[0] = NSPV_UTXOSRESP;
|
||||||
|
pnode->PushMessage("nSPV",response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void komodo_nSPVresp(CNode *pfrom,std::vector<uint8_t> response) // received a response
|
||||||
|
{
|
||||||
|
int32_t len;
|
||||||
|
if ( (len= response.size()) > 0 )
|
||||||
|
{
|
||||||
|
switch ( response[0] )
|
||||||
|
{
|
||||||
|
case NSPV_INFORESP:
|
||||||
|
fprintf(stderr,"got info response\n");
|
||||||
|
break;
|
||||||
|
case NSPV_UTXOSRESP:
|
||||||
|
fprintf(stderr,"got utxos response\n");
|
||||||
|
break;
|
||||||
|
default: fprintf(stderr,"unexpected response %02x size.%d\n",response[0],(int32_t)response.size());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
void komodo_nSPV(CNode *pto) // issue nSPV requests if has nServices
|
void komodo_nSPV(CNode *pto)
|
||||||
{
|
{
|
||||||
|
std::vector<uint8_t> request;
|
||||||
|
// limit frequency!
|
||||||
|
if ( (pto->nServices & NODE_ADDRINDEX) != 0 )
|
||||||
|
{
|
||||||
|
// get utxo since lastheight
|
||||||
|
payload.resize(1);
|
||||||
|
payload[0] = NSPV_UTXOS;
|
||||||
|
pnode->PushMessage("getnSPV",request);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// query current height, blockhash, notarization info
|
||||||
|
payload.resize(1);
|
||||||
|
payload[0] = NSPV_INFO;
|
||||||
|
pnode->PushMessage("getnSPV",request);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // KOMODO_NSPV_H
|
#endif // KOMODO_NSPV_H
|
||||||
|
|||||||
@@ -458,7 +458,7 @@ void CNode::PushVersion()
|
|||||||
LogPrint("net", "send version message: version %d, blocks=%d, us=%s, peer=%d\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString(), id);
|
LogPrint("net", "send version message: version %d, blocks=%d, us=%s, peer=%d\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString(), id);
|
||||||
PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
|
PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
|
||||||
nLocalHostNonce, strSubVersion, nBestHeight, true);
|
nLocalHostNonce, strSubVersion, nBestHeight, true);
|
||||||
fprintf(stderr,"PUSH services.%llx\n",(long long)nLocalServices);
|
//fprintf(stderr,"PUSH services.%llx\n",(long long)nLocalServices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user