Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show First 20 Lines • Show All 689 Lines • ▼ Show 20 Lines | public: | ||||
std::set<uint256> setKnown; | std::set<uint256> setKnown; | ||||
int64_t nNextAddrSend GUARDED_BY(cs_sendProcessing){0}; | int64_t nNextAddrSend GUARDED_BY(cs_sendProcessing){0}; | ||||
int64_t nNextLocalAddrSend GUARDED_BY(cs_sendProcessing){0}; | int64_t nNextLocalAddrSend GUARDED_BY(cs_sendProcessing){0}; | ||||
// Inventory based relay. | // Inventory based relay. | ||||
CRollingBloomFilter filterInventoryKnown GUARDED_BY(cs_inventory); | CRollingBloomFilter filterInventoryKnown GUARDED_BY(cs_inventory); | ||||
// Set of transaction ids we still have to announce. They are sorted by the | // Set of transaction ids we still have to announce. They are sorted by the | ||||
// mempool before relay, so the order is not important. | // mempool before relay, so the order is not important. | ||||
std::set<uint256> setInventoryTxToSend; | std::set<TxId> setInventoryTxToSend; | ||||
// List of block ids we still have announce. There is no final sorting | // List of block ids we still have announce. There is no final sorting | ||||
// before sending, as they are always sent immediately and in the order | // before sending, as they are always sent immediately and in the order | ||||
// requested. | // requested. | ||||
std::vector<uint256> vInventoryBlockToSend GUARDED_BY(cs_inventory); | std::vector<uint256> vInventoryBlockToSend GUARDED_BY(cs_inventory); | ||||
CCriticalSection cs_inventory; | CCriticalSection cs_inventory; | ||||
int64_t nNextInvSend{0}; | int64_t nNextInvSend{0}; | ||||
// Used for headers announcements - unfiltered blocks to relay. | // Used for headers announcements - unfiltered blocks to relay. | ||||
std::vector<BlockHash> vBlockHashesToAnnounce GUARDED_BY(cs_inventory); | std::vector<BlockHash> vBlockHashesToAnnounce GUARDED_BY(cs_inventory); | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | public: | ||||
void AddInventoryKnown(const CInv &inv) { | void AddInventoryKnown(const CInv &inv) { | ||||
LOCK(cs_inventory); | LOCK(cs_inventory); | ||||
filterInventoryKnown.insert(inv.hash); | filterInventoryKnown.insert(inv.hash); | ||||
} | } | ||||
void PushInventory(const CInv &inv) { | void PushInventory(const CInv &inv) { | ||||
LOCK(cs_inventory); | LOCK(cs_inventory); | ||||
if (inv.type == MSG_TX) { | if (inv.type == MSG_TX) { | ||||
if (!filterInventoryKnown.contains(inv.hash)) { | const TxId txid(inv.hash); | ||||
setInventoryTxToSend.insert(inv.hash); | if (!filterInventoryKnown.contains(txid)) { | ||||
setInventoryTxToSend.insert(txid); | |||||
} | } | ||||
} else if (inv.type == MSG_BLOCK) { | } else if (inv.type == MSG_BLOCK) { | ||||
vInventoryBlockToSend.push_back(inv.hash); | vInventoryBlockToSend.push_back(inv.hash); | ||||
} | } | ||||
} | } | ||||
void PushBlockHash(const BlockHash &hash) { | void PushBlockHash(const BlockHash &hash) { | ||||
LOCK(cs_inventory); | LOCK(cs_inventory); | ||||
Show All 23 Lines |