Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 2,781 Lines • ▼ Show 20 Lines | if (strCommand == NetMsgType::TX) { | ||||
bool fMissingInputs = false; | bool fMissingInputs = false; | ||||
CValidationState state; | CValidationState state; | ||||
CNodeState *nodestate = State(pfrom->GetId()); | CNodeState *nodestate = State(pfrom->GetId()); | ||||
nodestate->m_tx_download.m_tx_announced.erase(txid); | nodestate->m_tx_download.m_tx_announced.erase(txid); | ||||
nodestate->m_tx_download.m_tx_in_flight.erase(txid); | nodestate->m_tx_download.m_tx_in_flight.erase(txid); | ||||
EraseTxRequest(txid); | EraseTxRequest(txid); | ||||
if (!AlreadyHave(inv) && | if (!AlreadyHave(inv) && AcceptToMemoryPool(config, g_mempool, state, | ||||
AcceptToMemoryPool(config, g_mempool, state, ptx, true, | ptx, &fMissingInputs)) { | ||||
&fMissingInputs)) { | |||||
g_mempool.check(pcoinsTip.get()); | g_mempool.check(pcoinsTip.get()); | ||||
RelayTransaction(tx, connman); | RelayTransaction(tx, connman); | ||||
for (size_t i = 0; i < tx.vout.size(); i++) { | for (size_t i = 0; i < tx.vout.size(); i++) { | ||||
vWorkQueue.emplace_back(txid, i); | vWorkQueue.emplace_back(txid, i); | ||||
} | } | ||||
pfrom->nLastTXTime = GetTime(); | pfrom->nLastTXTime = GetTime(); | ||||
Show All 28 Lines | if (strCommand == NetMsgType::TX) { | ||||
auto it = rejectCountPerNode.find(fromPeer); | auto it = rejectCountPerNode.find(fromPeer); | ||||
if (it != rejectCountPerNode.end() && | if (it != rejectCountPerNode.end() && | ||||
it->second > MAX_NON_STANDARD_ORPHAN_PER_NODE) { | it->second > MAX_NON_STANDARD_ORPHAN_PER_NODE) { | ||||
continue; | continue; | ||||
} | } | ||||
if (AcceptToMemoryPool(config, g_mempool, stateDummy, | if (AcceptToMemoryPool(config, g_mempool, stateDummy, | ||||
porphanTx, true, &fMissingInputs2)) { | porphanTx, &fMissingInputs2)) { | ||||
LogPrint(BCLog::MEMPOOL, " accepted orphan tx %s\n", | LogPrint(BCLog::MEMPOOL, " accepted orphan tx %s\n", | ||||
orphanId.ToString()); | orphanId.ToString()); | ||||
RelayTransaction(orphanTx, connman); | RelayTransaction(orphanTx, connman); | ||||
for (size_t i = 0; i < orphanTx.vout.size(); i++) { | for (size_t i = 0; i < orphanTx.vout.size(); i++) { | ||||
vWorkQueue.emplace_back(orphanId, i); | vWorkQueue.emplace_back(orphanId, i); | ||||
} | } | ||||
vEraseQueue.push_back(orphanId); | vEraseQueue.push_back(orphanId); | ||||
} else if (!fMissingInputs2) { | } else if (!fMissingInputs2) { | ||||
▲ Show 20 Lines • Show All 1,875 Lines • ▼ Show 20 Lines | if (pto->nVersion >= FEEFILTER_VERSION && | ||||
1000000) | 1000000) | ||||
.GetFeePerK(); | .GetFeePerK(); | ||||
int64_t timeNow = GetTimeMicros(); | int64_t timeNow = GetTimeMicros(); | ||||
if (timeNow > pto->nextSendTimeFeeFilter) { | if (timeNow > pto->nextSendTimeFeeFilter) { | ||||
static CFeeRate default_feerate = | static CFeeRate default_feerate = | ||||
CFeeRate(DEFAULT_MIN_RELAY_TX_FEE_PER_KB); | CFeeRate(DEFAULT_MIN_RELAY_TX_FEE_PER_KB); | ||||
static FeeFilterRounder filterRounder(default_feerate); | static FeeFilterRounder filterRounder(default_feerate); | ||||
Amount filterToSend = filterRounder.round(currentFilter); | Amount filterToSend = filterRounder.round(currentFilter); | ||||
// If we don't allow free transactions, then we always have a fee | filterToSend = std::max(filterToSend, ::minRelayTxFee.GetFeePerK()); | ||||
// filter of at least minRelayTxFee | |||||
if (gArgs.GetArg("-limitfreerelay", DEFAULT_LIMITFREERELAY) <= 0) { | |||||
filterToSend = | |||||
std::max(filterToSend, ::minRelayTxFee.GetFeePerK()); | |||||
} | |||||
if (filterToSend != pto->lastSentFeeFilter) { | if (filterToSend != pto->lastSentFeeFilter) { | ||||
connman->PushMessage( | connman->PushMessage( | ||||
pto, msgMaker.Make(NetMsgType::FEEFILTER, filterToSend)); | pto, msgMaker.Make(NetMsgType::FEEFILTER, filterToSend)); | ||||
pto->lastSentFeeFilter = filterToSend; | pto->lastSentFeeFilter = filterToSend; | ||||
} | } | ||||
pto->nextSendTimeFeeFilter = | pto->nextSendTimeFeeFilter = | ||||
PoissonNextSend(timeNow, AVG_FEEFILTER_BROADCAST_INTERVAL); | PoissonNextSend(timeNow, AVG_FEEFILTER_BROADCAST_INTERVAL); | ||||
Show All 24 Lines |