Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show First 20 Lines • Show All 742 Lines • ▼ Show 20 Lines | public: | ||||
// 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<TxId> 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<BlockHash> vInventoryBlockToSend GUARDED_BY(cs_inventory); | ||||
RecursiveMutex cs_inventory; | RecursiveMutex 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); | ||||
// Used for BIP35 mempool sending. | // Used for BIP35 mempool sending. | ||||
bool fSendMempool GUARDED_BY(cs_inventory){false}; | bool fSendMempool GUARDED_BY(cs_inventory){false}; | ||||
// Last time a "MEMPOOL" request was serviced. | // Last time a "MEMPOOL" request was serviced. | ||||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | public: | ||||
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) { | ||||
const TxId txid(inv.hash); | const TxId txid(inv.hash); | ||||
if (!filterInventoryKnown.contains(txid)) { | if (!filterInventoryKnown.contains(txid)) { | ||||
setInventoryTxToSend.insert(txid); | setInventoryTxToSend.insert(txid); | ||||
} | } | ||||
} else if (inv.type == MSG_BLOCK) { | } else if (inv.type == MSG_BLOCK) { | ||||
vInventoryBlockToSend.push_back(inv.hash); | const BlockHash hash(inv.hash); | ||||
vInventoryBlockToSend.push_back(hash); | |||||
} | } | ||||
} | } | ||||
void PushBlockHash(const BlockHash &hash) { | void PushBlockHash(const BlockHash &hash) { | ||||
LOCK(cs_inventory); | LOCK(cs_inventory); | ||||
vBlockHashesToAnnounce.push_back(hash); | vBlockHashesToAnnounce.push_back(hash); | ||||
} | } | ||||
Show All 20 Lines |