diff options
Diffstat (limited to 'src/net_processing.h')
-rw-r--r-- | src/net_processing.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/net_processing.h b/src/net_processing.h index eaa3b142a8..d5801aadd3 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -7,16 +7,13 @@ #define BITCOIN_NET_PROCESSING_H #include <net.h> -#include <sync.h> #include <validationinterface.h> +class CAddrMan; class CChainParams; class CTxMemPool; class ChainstateManager; -extern RecursiveMutex cs_main; -extern RecursiveMutex g_cs_orphans; - /** Default for -maxorphantx, maximum number of orphan transactions kept in memory */ static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100; /** Default number of orphan+recently-replaced txn to keep around for block reconstruction */ @@ -30,23 +27,30 @@ struct CNodeStateStats { int nSyncHeight = -1; int nCommonHeight = -1; int m_starting_height = -1; + std::chrono::microseconds m_ping_wait; std::vector<int> vHeightInFlight; }; class PeerManager : public CValidationInterface, public NetEventsInterface { public: - static std::unique_ptr<PeerManager> make(const CChainParams& chainparams, CConnman& connman, BanMan* banman, - CScheduler& scheduler, ChainstateManager& chainman, CTxMemPool& pool, - bool ignore_incoming_txs); + static std::unique_ptr<PeerManager> make(const CChainParams& chainparams, CConnman& connman, CAddrMan& addrman, + BanMan* banman, CScheduler& scheduler, ChainstateManager& chainman, + CTxMemPool& pool, bool ignore_incoming_txs); virtual ~PeerManager() { } /** Get statistics from node state */ - virtual bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) = 0; + virtual bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) const = 0; /** Whether this node ignores txs received over p2p. */ virtual bool IgnoresIncomingTxs() = 0; + /** Relay transaction to all peers. */ + virtual void RelayTransaction(const uint256& txid, const uint256& wtxid) = 0; + + /** Send ping message to all peers */ + virtual void SendPings() = 0; + /** Set the best height */ virtual void SetBestHeight(int height) = 0; @@ -68,7 +72,4 @@ public: const std::chrono::microseconds time_received, const std::atomic<bool>& interruptMsgProc) = 0; }; -/** Relay transaction to every node */ -void RelayTransaction(const uint256& txid, const uint256& wtxid, const CConnman& connman) EXCLUSIVE_LOCKS_REQUIRED(cs_main); - #endif // BITCOIN_NET_PROCESSING_H |