Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show All 10 Lines | |||||
#include "addrman.h" | #include "addrman.h" | ||||
#include "amount.h" | #include "amount.h" | ||||
#include "bloom.h" | #include "bloom.h" | ||||
#include "chainparams.h" | #include "chainparams.h" | ||||
#include "compat.h" | #include "compat.h" | ||||
#include "hash.h" | #include "hash.h" | ||||
#include "limitedmap.h" | #include "limitedmap.h" | ||||
#include "netaddress.h" | #include "netaddress.h" | ||||
#include "primitives/transaction.h" | |||||
#include "protocol.h" | #include "protocol.h" | ||||
#include "random.h" | #include "random.h" | ||||
#include "streams.h" | #include "streams.h" | ||||
#include "sync.h" | #include "sync.h" | ||||
#include "threadinterrupt.h" | #include "threadinterrupt.h" | ||||
#include "uint256.h" | #include "uint256.h" | ||||
#include <atomic> | #include <atomic> | ||||
▲ Show 20 Lines • Show All 636 Lines • ▼ Show 20 Lines | public: | ||||
std::set<uint256> setKnown; | std::set<uint256> setKnown; | ||||
int64_t nNextAddrSend; | int64_t nNextAddrSend; | ||||
int64_t nNextLocalAddrSend; | int64_t nNextLocalAddrSend; | ||||
// Inventory based relay. | // Inventory based relay. | ||||
CRollingBloomFilter filterInventoryKnown; | CRollingBloomFilter filterInventoryKnown; | ||||
// 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<txhash_t> 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; | std::vector<uint256> vInventoryBlockToSend; | ||||
CCriticalSection cs_inventory; | CCriticalSection cs_inventory; | ||||
std::set<uint256> setAskFor; | std::set<uint256> setAskFor; | ||||
std::multimap<int64_t, CInv> mapAskFor; | std::multimap<int64_t, CInv> mapAskFor; | ||||
int64_t nNextInvSend; | int64_t nNextInvSend; | ||||
▲ Show 20 Lines • Show All 110 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 txhash_t txhash(inv.hash); | ||||
setInventoryTxToSend.insert(inv.hash); | if (!filterInventoryKnown.contains(txhash)) { | ||||
setInventoryTxToSend.insert(txhash); | |||||
} | } | ||||
} 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 uint256 &hash) { | void PushBlockHash(const uint256 &hash) { | ||||
LOCK(cs_inventory); | LOCK(cs_inventory); | ||||
Show All 25 Lines |