Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 211 Lines • ▼ Show 20 Lines | template <typename I> bool operator()(const I &a, const I &b) const { | ||||
return &(*a) < &(*b); | return &(*a) < &(*b); | ||||
} | } | ||||
}; | }; | ||||
std::map<COutPoint, | std::map<COutPoint, | ||||
std::set<std::map<uint256, COrphanTx>::iterator, IteratorComparator>> | std::set<std::map<uint256, COrphanTx>::iterator, IteratorComparator>> | ||||
mapOrphanTransactionsByPrev GUARDED_BY(g_cs_orphans); | mapOrphanTransactionsByPrev GUARDED_BY(g_cs_orphans); | ||||
static size_t vExtraTxnForCompactIt GUARDED_BY(g_cs_orphans) = 0; | static size_t vExtraTxnForCompactIt GUARDED_BY(g_cs_orphans) = 0; | ||||
static std::vector<std::pair<uint256, CTransactionRef>> | static std::vector<std::pair<TxHash, CTransactionRef>> | ||||
vExtraTxnForCompact GUARDED_BY(g_cs_orphans); | vExtraTxnForCompact GUARDED_BY(g_cs_orphans); | ||||
} // namespace | } // namespace | ||||
namespace { | namespace { | ||||
struct CBlockReject { | struct CBlockReject { | ||||
uint8_t chRejectCode; | uint8_t chRejectCode; | ||||
std::string strRejectReason; | std::string strRejectReason; | ||||
uint256 hashBlock; | uint256 hashBlock; | ||||
▲ Show 20 Lines • Show All 742 Lines • ▼ Show 20 Lines | if (max_extra_txn <= 0) { | ||||
return; | return; | ||||
} | } | ||||
if (!vExtraTxnForCompact.size()) { | if (!vExtraTxnForCompact.size()) { | ||||
vExtraTxnForCompact.resize(max_extra_txn); | vExtraTxnForCompact.resize(max_extra_txn); | ||||
} | } | ||||
vExtraTxnForCompact[vExtraTxnForCompactIt] = | vExtraTxnForCompact[vExtraTxnForCompactIt] = | ||||
std::make_pair(tx->GetId(), tx); | std::make_pair(tx->GetHash(), tx); | ||||
vExtraTxnForCompactIt = (vExtraTxnForCompactIt + 1) % max_extra_txn; | vExtraTxnForCompactIt = (vExtraTxnForCompactIt + 1) % max_extra_txn; | ||||
} | } | ||||
bool AddOrphanTx(const CTransactionRef &tx, NodeId peer) | bool AddOrphanTx(const CTransactionRef &tx, NodeId peer) | ||||
EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans) { | EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans) { | ||||
const uint256 &txid = tx->GetId(); | const uint256 &txid = tx->GetId(); | ||||
if (mapOrphanTransactions.count(txid)) { | if (mapOrphanTransactions.count(txid)) { | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 3,741 Lines • Show Last 20 Lines |