Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show First 20 Lines • Show All 990 Lines • ▼ Show 20 Lines | struct TxRelay { | ||||
Amount minFeeFilter GUARDED_BY(cs_feeFilter){Amount::zero()}; | Amount minFeeFilter GUARDED_BY(cs_feeFilter){Amount::zero()}; | ||||
Amount lastSentFeeFilter{Amount::zero()}; | Amount lastSentFeeFilter{Amount::zero()}; | ||||
int64_t nextSendTimeFeeFilter{0}; | int64_t nextSendTimeFeeFilter{0}; | ||||
}; | }; | ||||
// m_tx_relay == nullptr if we're not relaying transactions with this peer | // m_tx_relay == nullptr if we're not relaying transactions with this peer | ||||
std::unique_ptr<TxRelay> m_tx_relay; | std::unique_ptr<TxRelay> m_tx_relay; | ||||
struct ProofRelay { | |||||
mutable RecursiveMutex cs_proof_inventory; | |||||
std::set<avalanche::ProofId> | |||||
setInventoryProofToSend GUARDED_BY(cs_proof_inventory); | |||||
}; | |||||
// m_proof_relay == nullptr if we're not relaying proofs with this peer | |||||
std::unique_ptr<ProofRelay> m_proof_relay; | |||||
struct AvalancheState { | struct AvalancheState { | ||||
AvalancheState() {} | AvalancheState() {} | ||||
avalanche::Delegation delegation; | avalanche::Delegation delegation; | ||||
}; | }; | ||||
// m_avalanche_state == nullptr if we're not using avalanche with this peer | // m_avalanche_state == nullptr if we're not using avalanche with this peer | ||||
std::unique_ptr<AvalancheState> m_avalanche_state; | std::unique_ptr<AvalancheState> m_avalanche_state; | ||||
▲ Show 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | void PushTxInventory(const TxId &txid) { | ||||
return; | return; | ||||
} | } | ||||
LOCK(m_tx_relay->cs_tx_inventory); | LOCK(m_tx_relay->cs_tx_inventory); | ||||
if (!m_tx_relay->filterInventoryKnown.contains(txid)) { | if (!m_tx_relay->filterInventoryKnown.contains(txid)) { | ||||
m_tx_relay->setInventoryTxToSend.insert(txid); | m_tx_relay->setInventoryTxToSend.insert(txid); | ||||
} | } | ||||
} | } | ||||
void PushProofInventory(const avalanche::ProofId &proofid) { | |||||
if (m_proof_relay == nullptr) { | |||||
m_proof_relay = std::make_unique<ProofRelay>(); | |||||
deadalnix: 1/ This isn't thread safe
2/ The fact this skips inventories when the struct is null is a… | |||||
} | |||||
WITH_LOCK(m_proof_relay->cs_proof_inventory, | |||||
m_proof_relay->setInventoryProofToSend.insert(proofid)); | |||||
} | |||||
void CloseSocketDisconnect(); | void CloseSocketDisconnect(); | ||||
void copyStats(CNodeStats &stats, const std::vector<bool> &m_asmap); | void copyStats(CNodeStats &stats, const std::vector<bool> &m_asmap); | ||||
ServiceFlags GetLocalServices() const { return nLocalServices; } | ServiceFlags GetLocalServices() const { return nLocalServices; } | ||||
std::string GetAddrName() const; | std::string GetAddrName() const; | ||||
//! Sets the addrName only if it was not previously set | //! Sets the addrName only if it was not previously set | ||||
Show All 21 Lines |
1/ This isn't thread safe
2/ The fact this skips inventories when the struct is null is a feature, not a bug. This is the whole point of that design.