Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show First 20 Lines • Show All 763 Lines • ▼ Show 20 Lines | struct TxRelay { | ||||
RecursiveMutex cs_feeFilter; | RecursiveMutex cs_feeFilter; | ||||
// Minimum fee rate with which to filter inv's to this node | // Minimum fee rate with which to filter inv's to this node | ||||
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}; | ||||
}; | }; | ||||
TxRelay m_tx_relay; | std::unique_ptr<TxRelay> m_tx_relay; | ||||
// 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); | ||||
// Block and TXN accept times | // Block and TXN accept times | ||||
std::atomic<int64_t> nLastBlockTime{0}; | std::atomic<int64_t> nLastBlockTime{0}; | ||||
std::atomic<int64_t> nLastTXTime{0}; | std::atomic<int64_t> nLastTXTime{0}; | ||||
// Ping time measurement: | // Ping time measurement: | ||||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | void PushAddress(const CAddress &_addr, FastRandomContext &insecure_rand) { | ||||
_addr; | _addr; | ||||
} else { | } else { | ||||
vAddrToSend.push_back(_addr); | vAddrToSend.push_back(_addr); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
void AddInventoryKnown(const CInv &inv) { | void AddInventoryKnown(const CInv &inv) { | ||||
LOCK(m_tx_relay.cs_tx_inventory); | LOCK(m_tx_relay->cs_tx_inventory); | ||||
m_tx_relay.filterInventoryKnown.insert(inv.hash); | m_tx_relay->filterInventoryKnown.insert(inv.hash); | ||||
} | } | ||||
void PushInventory(const CInv &inv) { | void PushInventory(const CInv &inv) { | ||||
if (inv.type == MSG_TX) { | if (inv.type == MSG_TX) { | ||||
const TxId txid(inv.hash); | const TxId txid(inv.hash); | ||||
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); | ||||
} | } | ||||
} else if (inv.type == MSG_BLOCK) { | } else if (inv.type == MSG_BLOCK) { | ||||
const BlockHash hash(inv.hash); | const BlockHash hash(inv.hash); | ||||
LOCK(cs_inventory); | LOCK(cs_inventory); | ||||
vInventoryBlockToSend.push_back(hash); | vInventoryBlockToSend.push_back(hash); | ||||
} | } | ||||
} | } | ||||
Show All 25 Lines |