Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show First 20 Lines • Show All 674 Lines • ▼ Show 20 Lines | public: | ||||
std::atomic_bool fPauseRecv{false}; | std::atomic_bool fPauseRecv{false}; | ||||
std::atomic_bool fPauseSend{false}; | std::atomic_bool fPauseSend{false}; | ||||
protected: | protected: | ||||
mapMsgCmdSize mapSendBytesPerMsgCmd; | mapMsgCmdSize mapSendBytesPerMsgCmd; | ||||
mapMsgCmdSize mapRecvBytesPerMsgCmd GUARDED_BY(cs_vRecv); | mapMsgCmdSize mapRecvBytesPerMsgCmd GUARDED_BY(cs_vRecv); | ||||
public: | public: | ||||
uint256 hashContinue; | BlockHash hashContinue; | ||||
std::atomic<int> nStartingHeight{-1}; | std::atomic<int> nStartingHeight{-1}; | ||||
// flood relay | // flood relay | ||||
std::vector<CAddress> vAddrToSend; | std::vector<CAddress> vAddrToSend; | ||||
CRollingBloomFilter addrKnown; | CRollingBloomFilter addrKnown; | ||||
bool fGetAddr{false}; | bool fGetAddr{false}; | ||||
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<uint256> 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<uint256> 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. | ||||
std::atomic<int64_t> timeLastMempoolReq{0}; | std::atomic<int64_t> timeLastMempoolReq{0}; | ||||
// Block and TXN accept times | // Block and TXN accept times | ||||
std::atomic<int64_t> nLastBlockTime{0}; | std::atomic<int64_t> nLastBlockTime{0}; | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | void PushInventory(const CInv &inv) { | ||||
if (!filterInventoryKnown.contains(inv.hash)) { | if (!filterInventoryKnown.contains(inv.hash)) { | ||||
setInventoryTxToSend.insert(inv.hash); | setInventoryTxToSend.insert(inv.hash); | ||||
} | } | ||||
} 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 BlockHash &hash) { | ||||
LOCK(cs_inventory); | LOCK(cs_inventory); | ||||
vBlockHashesToAnnounce.push_back(hash); | vBlockHashesToAnnounce.push_back(hash); | ||||
} | } | ||||
void CloseSocketDisconnect(); | void CloseSocketDisconnect(); | ||||
void copyStats(CNodeStats &stats); | void copyStats(CNodeStats &stats); | ||||
Show All 16 Lines |