Allow "inv" to be sent from superlite client

This commit is contained in:
jl777
2019-07-05 06:57:09 -11:00
parent 7ebd445768
commit 7c6f471173
3 changed files with 29 additions and 32 deletions

View File

@@ -8243,35 +8243,35 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
state.fShouldBan = false; state.fShouldBan = false;
} }
komodo_nSPV(pto); komodo_nSPV(pto);
if ( KOMODO_NSPV != 0 ) if ( KOMODO_NSPV == 0 )
return(true); {
BOOST_FOREACH(const CBlockReject& reject, state.rejects) BOOST_FOREACH(const CBlockReject& reject, state.rejects)
pto->PushMessage("reject", (string)"block", reject.chRejectCode, reject.strRejectReason, reject.hashBlock); pto->PushMessage("reject", (string)"block", reject.chRejectCode, reject.strRejectReason, reject.hashBlock);
state.rejects.clear(); state.rejects.clear();
// Start block sync // Start block sync
if (pindexBestHeader == NULL) if (pindexBestHeader == NULL)
pindexBestHeader = chainActive.Tip(); pindexBestHeader = chainActive.Tip();
bool fFetch = state.fPreferredDownload || (nPreferredDownload == 0 && !pto->fClient && !pto->fOneShot); // Download if this is a nice peer, or we have no nice peers and this one might do. bool fFetch = state.fPreferredDownload || (nPreferredDownload == 0 && !pto->fClient && !pto->fOneShot); // Download if this is a nice peer, or we have no nice peers and this one might do.
if (!state.fSyncStarted && !pto->fClient && !fImporting && !fReindex && pindexBestHeader!=0) { if (!state.fSyncStarted && !pto->fClient && !fImporting && !fReindex && pindexBestHeader!=0) {
// Only actively request headers from a single peer, unless we're close to today. // Only actively request headers from a single peer, unless we're close to today.
if ((nSyncStarted == 0 && fFetch) || pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60) { if ((nSyncStarted == 0 && fFetch) || pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60) {
state.fSyncStarted = true; state.fSyncStarted = true;
nSyncStarted++; nSyncStarted++;
CBlockIndex *pindexStart = pindexBestHeader->pprev ? pindexBestHeader->pprev : pindexBestHeader; CBlockIndex *pindexStart = pindexBestHeader->pprev ? pindexBestHeader->pprev : pindexBestHeader;
LogPrint("net", "initial getheaders (%d) to peer=%d (startheight:%d)\n", pindexStart->GetHeight(), pto->id, pto->nStartingHeight); LogPrint("net", "initial getheaders (%d) to peer=%d (startheight:%d)\n", pindexStart->GetHeight(), pto->id, pto->nStartingHeight);
pto->PushMessage("getheaders", chainActive.GetLocator(pindexStart), uint256()); pto->PushMessage("getheaders", chainActive.GetLocator(pindexStart), uint256());
}
}
// Resend wallet transactions that haven't gotten in a block yet
// Except during reindex, importing and IBD, when old wallet
// transactions become unconfirmed and spams other nodes.
if (!fReindex && !fImporting && !IsInitialBlockDownload())
{
GetMainSignals().Broadcast(nTimeBestReceived);
} }
} }
// Resend wallet transactions that haven't gotten in a block yet
// Except during reindex, importing and IBD, when old wallet
// transactions become unconfirmed and spams other nodes.
if (!fReindex && !fImporting && !IsInitialBlockDownload())
{
GetMainSignals().Broadcast(nTimeBestReceived);
}
// //
// Message: inventory // Message: inventory
// //
@@ -8319,7 +8319,8 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
} }
if (!vInv.empty()) if (!vInv.empty())
pto->PushMessage("inv", vInv); pto->PushMessage("inv", vInv);
if ( KOMODO_NSPV != 0 )
return(true);
// Detect whether we're stalling // Detect whether we're stalling
int64_t nNow = GetTimeMicros(); int64_t nNow = GetTimeMicros();
if (!pto->fDisconnect && state.nStallingSince && state.nStallingSince < nNow - 1000000 * BLOCK_STALLING_TIMEOUT) { if (!pto->fDisconnect && state.nStallingSince && state.nStallingSince < nNow - 1000000 * BLOCK_STALLING_TIMEOUT) {

View File

@@ -1897,7 +1897,6 @@ void RelayTransaction(const CTransaction& tx)
void RelayTransaction(const CTransaction& tx, const CDataStream& ss) void RelayTransaction(const CTransaction& tx, const CDataStream& ss)
{ {
fprintf(stderr,"RelayTransaction\n");
CInv inv(MSG_TX, tx.GetHash()); CInv inv(MSG_TX, tx.GetHash());
{ {
LOCK(cs_mapRelay); LOCK(cs_mapRelay);
@@ -1915,10 +1914,8 @@ void RelayTransaction(const CTransaction& tx, const CDataStream& ss)
LOCK(cs_vNodes); LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes) BOOST_FOREACH(CNode* pnode, vNodes)
{ {
fprintf(stderr,"pnode relay tx.%d\n",(int32_t)pnode->fRelayTxes);
if(!pnode->fRelayTxes) if(!pnode->fRelayTxes)
continue; continue;
fprintf(stderr,"found pnode\n");
LOCK(pnode->cs_filter); LOCK(pnode->cs_filter);
if (pnode->pfilter) if (pnode->pfilter)
{ {

View File

@@ -1342,7 +1342,6 @@ UniValue sendrawtransaction(const UniValue& params, bool fHelp)
} }
} }
RelayTransaction(tx); RelayTransaction(tx);
return hashTx.GetHex(); return hashTx.GetHex();
} }