Skip to content

Commit

Permalink
fix: use AddFoundNode method replace AddInboundNode
Browse files Browse the repository at this point in the history
  • Loading branch information
fearlessfe committed Dec 8, 2024
1 parent 4d9bc61 commit 99e6a62
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions portalwire/portal_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (p *PortalProtocol) RoutingTableInfo() [][]string {
}

func (p *PortalProtocol) AddEnr(n *enode.Node) {
added := p.table.AddInboundNode(n)
added := p.table.AddFoundNode(n, true)
if !added {
p.Log.Warn("add node failed", "id", n.ID(), "ip", n.IPAddr())
return
Expand Down Expand Up @@ -315,11 +315,10 @@ func (p *PortalProtocol) setupDiscV5AndTable() error {
}

cfg := discover.Config{
PrivateKey: p.PrivateKey,
NetRestrict: p.NetRestrict,
Bootnodes: p.BootstrapNodes,
Log: p.Log,
NoFindnodeLivenessCheck: true,
PrivateKey: p.PrivateKey,
NetRestrict: p.NetRestrict,
Bootnodes: p.BootstrapNodes,
Log: p.Log,
}

p.table, err = discover.NewTable(p, p.localNode.Database(), cfg)
Expand Down Expand Up @@ -971,7 +970,9 @@ func (p *PortalProtocol) handleFindNodes(fromAddr *net.UDPAddr, request *FindNod
enrs := p.truncateNodes(nodes, maxPayloadSize, enrOverhead)

nodesMsg := &Nodes{
Total: uint8(len(enrs)),
// https://github.com/ethereum/portal-network-specs/blob/master/portal-wire-protocol.md
// total: The total number of Nodes response messages being sent. Currently fixed to only 1 response message.
Total: 1,
Enrs: enrs,
}

Expand Down

0 comments on commit 99e6a62

Please sign in to comment.