@@ -1147,9 +1147,11 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
// Option to startup with mocktime set (used for regression testing):
|
||||
SetMockTime(GetArg("-mocktime", 0)); // SetMockTime(0) is a no-op
|
||||
|
||||
if (GetBoolArg("-peerbloomfilters", true))
|
||||
nLocalServices |= NODE_BLOOM;
|
||||
|
||||
if ( KOMODO_NSPV == 0 )
|
||||
{
|
||||
if (GetBoolArg("-peerbloomfilters", true))
|
||||
nLocalServices |= NODE_BLOOM;
|
||||
}
|
||||
nMaxTipAge = GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
|
||||
|
||||
#ifdef ENABLE_MINING
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
// CC signing
|
||||
// make sure to sanity check all vector lengths on receipt
|
||||
// make sure no files are updated (this is to allow nSPV=1 and later nSPV=0 without affecting database)
|
||||
// bug: under load, fullnode was returning all 0 nServices
|
||||
|
||||
#ifndef KOMODO_NSPV_H
|
||||
#define KOMODO_NSPV_H
|
||||
|
||||
@@ -210,12 +210,17 @@ int32_t NSPV_sendrawtransaction(struct NSPV_broadcastresp *ptr,uint8_t *data,int
|
||||
{
|
||||
LOCK(cs_main);
|
||||
ptr->txid = tx.GetHash();
|
||||
fprintf(stderr,"addmempool transaction %s\n",ptr->txid.GetHex().c_str());
|
||||
fprintf(stderr,"try to addmempool transaction %s\n",ptr->txid.GetHex().c_str());
|
||||
if ( myAddtomempool(tx) != 0 )
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<n; i++)
|
||||
fprintf(stderr,"%02x",data[i]);
|
||||
fprintf(stderr," relay transaction %s retcode.%d\n",ptr->txid.GetHex().c_str(),ptr->retcode);
|
||||
ptr->retcode = 1;
|
||||
else ptr->retcode = 0;
|
||||
//fprintf(stderr,"relay transaction %s retcode.%d\n",ptr->txid.GetHex().c_str(),ptr->retcode);
|
||||
RelayTransaction(tx);
|
||||
RelayTransaction(tx);
|
||||
} else ptr->retcode = -3;
|
||||
|
||||
} else ptr->retcode = -1;
|
||||
return(sizeof(*ptr));
|
||||
}
|
||||
|
||||
@@ -102,6 +102,8 @@ void komodo_nSPVresp(CNode *pfrom,std::vector<uint8_t> response) // received a r
|
||||
CNode *NSPV_req(CNode *pnode,uint8_t *msg,int32_t len,uint64_t mask,int32_t ind)
|
||||
{
|
||||
int32_t n,flag = 0; CNode *pnodes[64]; uint32_t timestamp = (uint32_t)time(NULL);
|
||||
//if ( KOMODO_NSPV == 0 )
|
||||
// return(0);
|
||||
if ( pnode == 0 )
|
||||
{
|
||||
memset(pnodes,0,sizeof(pnodes));
|
||||
@@ -129,7 +131,8 @@ CNode *NSPV_req(CNode *pnode,uint8_t *msg,int32_t len,uint64_t mask,int32_t ind)
|
||||
std::vector<uint8_t> request;
|
||||
request.resize(len);
|
||||
memcpy(&request[0],msg,len);
|
||||
//fprintf(stderr,"pushmessage [%d] len.%d\n",msg[0],len);
|
||||
if ( KOMODO_NSPV == 0 )
|
||||
fprintf(stderr,"pushmessage [%d] len.%d\n",msg[0],len);
|
||||
pnode->PushMessage("getnSPV",request);
|
||||
pnode->prevtimes[ind] = timestamp;
|
||||
return(pnode);
|
||||
|
||||
@@ -132,7 +132,7 @@ bool NSPV_SignTx(CMutableTransaction &mtx,int32_t vini,int64_t utxovalue,const C
|
||||
fprintf(stderr,"%02x",((uint8_t *)&scriptPubKey)[i]);
|
||||
fprintf(stderr," scriptPubKey\n");
|
||||
}
|
||||
if ( nTime < KOMODO_SAPLING_ACTIVATION )
|
||||
if ( nTime != 0 && nTime < KOMODO_SAPLING_ACTIVATION )
|
||||
{
|
||||
fprintf(stderr,"use legacy sig validation\n");
|
||||
branchid = 0;
|
||||
|
||||
@@ -3974,7 +3974,8 @@ bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode) {
|
||||
|
||||
void FlushStateToDisk() {
|
||||
CValidationState state;
|
||||
FlushStateToDisk(state, FLUSH_STATE_ALWAYS);
|
||||
if ( KOMODO_NSPV == 0 )
|
||||
FlushStateToDisk(state, FLUSH_STATE_ALWAYS);
|
||||
}
|
||||
|
||||
void PruneAndFlush() {
|
||||
@@ -7247,7 +7248,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
{
|
||||
if ( (pfrom->nServices & NODE_NSPV) == 0 )
|
||||
{
|
||||
//fprintf(stderr,"invalid nSPV peer.%d\n",pfrom->id);
|
||||
// fprintf(stderr,"invalid nServices.%llx nSPV peer.%d\n",(long long)pfrom->nServices,pfrom->id);
|
||||
pfrom->fDisconnect = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -444,6 +444,8 @@ void CNode::CloseSocketDisconnect()
|
||||
vRecvMsg.clear();
|
||||
}
|
||||
|
||||
extern int32_t KOMODO_NSPV;
|
||||
|
||||
void CNode::PushVersion()
|
||||
{
|
||||
int nBestHeight = g_signals.GetHeight().get_value_or(0);
|
||||
@@ -458,7 +460,7 @@ void CNode::PushVersion()
|
||||
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,
|
||||
nLocalHostNonce, strSubVersion, nBestHeight, true);
|
||||
//fprintf(stderr,"PUSH services.%llx\n",(long long)nLocalServices);
|
||||
//fprintf(stderr,"KOMODO_NSPV.%d PUSH services.%llx\n",KOMODO_NSPV,(long long)nLocalServices);
|
||||
}
|
||||
|
||||
|
||||
@@ -1841,7 +1843,7 @@ bool StopNode()
|
||||
for (int i=0; i<MAX_OUTBOUND_CONNECTIONS; i++)
|
||||
semOutbound->post();
|
||||
|
||||
if (fAddressesInitialized)
|
||||
if (KOMODO_NSPV == 0 && fAddressesInitialized)
|
||||
{
|
||||
DumpAddresses();
|
||||
fAddressesInitialized = false;
|
||||
|
||||
Reference in New Issue
Block a user