Browse Source

Allow "inv" to be sent from superlite client

warmup
jl777 5 years ago
parent
commit
7c6f471173
  1. 57
      src/main.cpp
  2. 3
      src/net.cpp
  3. 1
      src/rpc/rawtransaction.cpp

57
src/main.cpp

@ -8243,35 +8243,35 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
state.fShouldBan = false;
}
komodo_nSPV(pto);
if ( KOMODO_NSPV != 0 )
return(true);
BOOST_FOREACH(const CBlockReject& reject, state.rejects)
pto->PushMessage("reject", (string)"block", reject.chRejectCode, reject.strRejectReason, reject.hashBlock);
state.rejects.clear();
// Start block sync
if (pindexBestHeader == NULL)
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.
if (!state.fSyncStarted && !pto->fClient && !fImporting && !fReindex && pindexBestHeader!=0) {
// Only actively request headers from a single peer, unless we're close to today.
if ((nSyncStarted == 0 && fFetch) || pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60) {
state.fSyncStarted = true;
nSyncStarted++;
CBlockIndex *pindexStart = pindexBestHeader->pprev ? pindexBestHeader->pprev : pindexBestHeader;
LogPrint("net", "initial getheaders (%d) to peer=%d (startheight:%d)\n", pindexStart->GetHeight(), pto->id, pto->nStartingHeight);
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())
if ( KOMODO_NSPV == 0 )
{
GetMainSignals().Broadcast(nTimeBestReceived);
BOOST_FOREACH(const CBlockReject& reject, state.rejects)
pto->PushMessage("reject", (string)"block", reject.chRejectCode, reject.strRejectReason, reject.hashBlock);
state.rejects.clear();
// Start block sync
if (pindexBestHeader == NULL)
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.
if (!state.fSyncStarted && !pto->fClient && !fImporting && !fReindex && pindexBestHeader!=0) {
// Only actively request headers from a single peer, unless we're close to today.
if ((nSyncStarted == 0 && fFetch) || pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60) {
state.fSyncStarted = true;
nSyncStarted++;
CBlockIndex *pindexStart = pindexBestHeader->pprev ? pindexBestHeader->pprev : pindexBestHeader;
LogPrint("net", "initial getheaders (%d) to peer=%d (startheight:%d)\n", pindexStart->GetHeight(), pto->id, pto->nStartingHeight);
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);
}
}
//
// Message: inventory
//
@ -8319,7 +8319,8 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
}
if (!vInv.empty())
pto->PushMessage("inv", vInv);
if ( KOMODO_NSPV != 0 )
return(true);
// Detect whether we're stalling
int64_t nNow = GetTimeMicros();
if (!pto->fDisconnect && state.nStallingSince && state.nStallingSince < nNow - 1000000 * BLOCK_STALLING_TIMEOUT) {

3
src/net.cpp

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

1
src/rpc/rawtransaction.cpp

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

Loading…
Cancel
Save