Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 1,196 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
/** | /** | ||||
* Returns true if the given validation state result may result in a peer | * Returns true if the given validation state result may result in a peer | ||||
* banning/disconnecting us. We use this to determine which unaccepted | * banning/disconnecting us. We use this to determine which unaccepted | ||||
* transactions from a whitelisted peer that we can safely relay. | * transactions from a whitelisted peer that we can safely relay. | ||||
*/ | */ | ||||
static bool TxRelayMayResultInDisconnect(const CValidationState &state) { | static bool TxRelayMayResultInDisconnect(const CValidationState &state) { | ||||
assert(IsTransactionReason(state.GetReason())); | |||||
return state.GetReason() == ValidationInvalidReason::CONSENSUS; | return state.GetReason() == ValidationInvalidReason::CONSENSUS; | ||||
} | } | ||||
/** | /** | ||||
* Potentially ban a node based on the contents of a CValidationState object | * Potentially ban a node based on the contents of a CValidationState object | ||||
* | * | ||||
* @param[in] via_compact_block: this bool is passed in because net_processing | * @param[in] via_compact_block: this bool is passed in because net_processing | ||||
* should punish peers differently depending on whether the data was provided in | * should punish peers differently depending on whether the data was provided in | ||||
▲ Show 20 Lines • Show All 988 Lines • ▼ Show 20 Lines | while (!done && !orphan_work_set.empty()) { | ||||
/*via_compact_block*/ false); | /*via_compact_block*/ false); | ||||
LogPrint(BCLog::MEMPOOL, " invalid orphan tx %s\n", | LogPrint(BCLog::MEMPOOL, " invalid orphan tx %s\n", | ||||
orphanTxId.ToString()); | orphanTxId.ToString()); | ||||
} | } | ||||
// Has inputs but not accepted to mempool | // Has inputs but not accepted to mempool | ||||
// Probably non-standard or insufficient fee | // Probably non-standard or insufficient fee | ||||
LogPrint(BCLog::MEMPOOL, " removed orphan tx %s\n", | LogPrint(BCLog::MEMPOOL, " removed orphan tx %s\n", | ||||
orphanTxId.ToString()); | orphanTxId.ToString()); | ||||
assert(IsTransactionReason(orphan_state.GetReason())); | |||||
assert(recentRejects); | assert(recentRejects); | ||||
recentRejects->insert(orphanTxId); | recentRejects->insert(orphanTxId); | ||||
EraseOrphanTx(orphanTxId); | EraseOrphanTx(orphanTxId); | ||||
done = true; | done = true; | ||||
} | } | ||||
g_mempool.check(pcoinsTip.get()); | g_mempool.check(pcoinsTip.get()); | ||||
▲ Show 20 Lines • Show All 820 Lines • ▼ Show 20 Lines | if (strCommand == NetMsgType::TX) { | ||||
LogPrint(BCLog::MEMPOOL, | LogPrint(BCLog::MEMPOOL, | ||||
"not keeping orphan with rejected parents %s\n", | "not keeping orphan with rejected parents %s\n", | ||||
tx.GetId().ToString()); | tx.GetId().ToString()); | ||||
// We will continue to reject this tx since it has rejected | // We will continue to reject this tx since it has rejected | ||||
// parents so avoid re-requesting it from other peers. | // parents so avoid re-requesting it from other peers. | ||||
recentRejects->insert(tx.GetId()); | recentRejects->insert(tx.GetId()); | ||||
} | } | ||||
} else { | } else { | ||||
assert(IsTransactionReason(state.GetReason())); | |||||
assert(recentRejects); | assert(recentRejects); | ||||
recentRejects->insert(tx.GetId()); | recentRejects->insert(tx.GetId()); | ||||
if (RecursiveDynamicUsage(*ptx) < 100000) { | if (RecursiveDynamicUsage(*ptx) < 100000) { | ||||
AddToCompactExtraTransactions(ptx); | AddToCompactExtraTransactions(ptx); | ||||
} | } | ||||
if (pfrom->HasPermission(PF_FORCERELAY)) { | if (pfrom->HasPermission(PF_FORCERELAY)) { | ||||
// Always relay transactions received from whitelisted peers, | // Always relay transactions received from whitelisted peers, | ||||
// even if they were already in the mempool or rejected from it | // even if they were already in the mempool or rejected from it | ||||
// due to policy, allowing the node to function as a gateway for | // due to policy, allowing the node to function as a gateway for | ||||
▲ Show 20 Lines • Show All 2,026 Lines • Show Last 20 Lines |