diff --git a/src/init.cpp b/src/init.cpp index 738d94377..4adde6681 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -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 diff --git a/src/komodo_nSPV.h b/src/komodo_nSPV.h index d4a4fd90f..e0a003fcd 100644 --- a/src/komodo_nSPV.h +++ b/src/komodo_nSPV.h @@ -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 diff --git a/src/komodo_nSPV_fullnode.h b/src/komodo_nSPV_fullnode.h index cdfb0f57e..948846fe5 100644 --- a/src/komodo_nSPV_fullnode.h +++ b/src/komodo_nSPV_fullnode.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; itxid.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)); } diff --git a/src/komodo_nSPV_superlite.h b/src/komodo_nSPV_superlite.h index 75fffb761..9a30ddc44 100644 --- a/src/komodo_nSPV_superlite.h +++ b/src/komodo_nSPV_superlite.h @@ -102,6 +102,8 @@ void komodo_nSPVresp(CNode *pfrom,std::vector 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 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); diff --git a/src/komodo_nSPV_wallet.h b/src/komodo_nSPV_wallet.h index e0a477ed3..6cf2e82c6 100644 --- a/src/komodo_nSPV_wallet.h +++ b/src/komodo_nSPV_wallet.h @@ -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; diff --git a/src/main.cpp b/src/main.cpp index 339f4e790..a8ff33c2b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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; } diff --git a/src/net.cpp b/src/net.cpp index 0586d7124..02cddd3e2 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -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; ipost(); - if (fAddressesInitialized) + if (KOMODO_NSPV == 0 && fAddressesInitialized) { DumpAddresses(); fAddressesInitialized = false;