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 12, 2024
1 parent 55a4a2e commit 0bdefcb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions discv5/crawler.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,18 @@ 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{}

properties["ip"] = node.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 0bdefcb

Please sign in to comment.