Skip to content

Commit ac7fec2

Browse files
fearlessfeGrapeBaBa
authored andcommitted
fix: use AddFoundNode method replace AddInboundNode
1 parent 48cb84a commit ac7fec2

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

portalwire/portal_protocol.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ func (p *PortalProtocol) RoutingTableInfo() [][]string {
280280
}
281281

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

317317
cfg := discover.Config{
318-
PrivateKey: p.PrivateKey,
319-
NetRestrict: p.NetRestrict,
320-
Bootnodes: p.BootstrapNodes,
321-
Log: p.Log,
322-
NoFindnodeLivenessCheck: true,
318+
PrivateKey: p.PrivateKey,
319+
NetRestrict: p.NetRestrict,
320+
Bootnodes: p.BootstrapNodes,
321+
Log: p.Log,
323322
}
324323

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

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

0 commit comments

Comments
 (0)