discv4::DialHistory¶
Tracks recently-dialed peers and suppresses retry attempts until a configurable cooldown expires. More...
#include <dial_history.hpp>
Public Types¶
| Name | |
|---|---|
| using std::chrono::steady_clock | Clock |
| using Clock::time_point | TimePoint |
| using Clock::duration | Duration |
Public Functions¶
| Name | |
|---|---|
| DialHistory(Duration expiry =kDefaultExpiry) | |
| void | add(const std::array< uint8_t, 64 > & node_id) Record that a node has just been dialed. |
| bool | contains(const std::array< uint8_t, 64 > & node_id) const Returns true if the node was recently dialed and the cooldown has not yet expired. Does NOT call expire() automatically — call expire() first if you want stale entries pruned. |
| void | expire() Remove all entries whose expiry time has passed. |
| std::size_t | size() const Number of active (non-expired) entries. |
Public Attributes¶
| Name | |
|---|---|
| Duration | kDefaultExpiry Default expiry duration matching go-ethereum's dialHistoryExpiration. |
Detailed Description¶
Tracks recently-dialed peers and suppresses retry attempts until a configurable cooldown expires.
Mirrors go-ethereum's expHeap-backed dial history in p2p/dial.go. The default expiry (35 s) matches go-ethereum's dialHistoryExpiration (inboundThrottleTime 30 s + 5 s guard).
Not thread-safe — callers must serialise access if needed.
Public Types Documentation¶
using Clock¶
using TimePoint¶
using Duration¶
Public Functions Documentation¶
function DialHistory¶
Parameters:
- expiry How long a dialed node is suppressed before being retried.
function add¶
Record that a node has just been dialed.
Parameters:
- node_id 64-byte secp256k1 public key identifying the peer.
function contains¶
Returns true if the node was recently dialed and the cooldown has not yet expired. Does NOT call expire() automatically — call expire() first if you want stale entries pruned.
Parameters:
- node_id 64-byte secp256k1 public key identifying the peer.
function expire¶
Remove all entries whose expiry time has passed.
function size¶
Number of active (non-expired) entries.
Public Attributes Documentation¶
variable kDefaultExpiry¶
Default expiry duration matching go-ethereum's dialHistoryExpiration.
Updated on 2026-04-13 at 23:22:46 -0700