Skip to content

Commit

Permalink
feat: store additional ENR fields
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis-tra committed Feb 13, 2024
1 parent 55a4a2e commit 904cb5d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions discv5/crawler.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,21 @@ func (c *Crawler) Work(ctx context.Context, task PeerInfo) (core.CrawlResult[Pee
func (c *Crawler) PeerProperties(node *enode.Node) map[string]any {
properties := map[string]any{}

if ip := node.IP(); ip != nil {
properties["ip"] = ip.String()
}

properties["seq"] = node.Record().Seq()
properties["signature"] = node.Record().Signature()

if node.UDP() != 0 {
properties["udp"] = node.UDP()
}

if node.TCP() != 0 {
properties["tcp"] = node.TCP()
}

var enrEntryEth2 ENREntryEth2
if err := node.Load(&enrEntryEth2); err == nil {
properties["fork_digest"] = enrEntryEth2.ForkDigest.String()
Expand Down

0 comments on commit 904cb5d

Please sign in to comment.