go-ethereum/p2p/discover
lightclient cc22e0cdf0
p2p/discover: fix update logic in handleAddNode (#29836)
It seems the semantic differences between addFoundNode and addInboundNode were lost in
#29572. My understanding is addFoundNode is for a node you have not contacted directly
(and are unsure if is available) whereas addInboundNode is for adding nodes that have
contacted the local node and we can verify they are active.

handleAddNode seems to be the consolidation of those two methods, yet it bumps the node in
the bucket (updating it's IP addr) even if the node was not an inbound. This PR fixes
this. It wasn't originally caught in tests like TestTable_addSeenNode because the
manipulation of the node object actually modified the node value used by the test.

New logic is added to reject non-inbound updates unless the sequence number of the
(signed) ENR increases. Inbound updates, which are published by the updated node itself,
are always accepted. If an inbound update changes the endpoint, the node will be
revalidated on an expedited schedule.

Co-authored-by: Felix Lange <fjl@twurst.com>
2024-05-28 21:30:17 +02:00
..
v4wire all: use rlp.DecodeBytes instead of rlp.Decode where possible (#27994) 2023-08-24 11:47:42 +03:00
v5wire p2p/discover/v5wire: add tests for invalid handshake and auth data size (#29708) 2024-05-06 13:17:19 +02:00
common.go p2p/discover: improved node revalidation (#29572) 2024-05-23 14:26:09 +02:00
lookup.go p2p/discover: improved node revalidation (#29572) 2024-05-23 14:26:09 +02:00
metrics.go all: fix mismatched names in comments (#29348) 2024-03-26 21:01:28 +01:00
node.go p2p/discover: fix crash when revalidated node is removed (#29864) 2024-05-28 18:13:03 +02:00
ntp.go all: remove dependency on golang.org/exp (#29314) 2024-03-25 07:50:18 +01:00
table.go p2p/discover: fix update logic in handleAddNode (#29836) 2024-05-28 21:30:17 +02:00
table_reval.go p2p/discover: fix update logic in handleAddNode (#29836) 2024-05-28 21:30:17 +02:00
table_reval_test.go p2p/discover: fix update logic in handleAddNode (#29836) 2024-05-28 21:30:17 +02:00
table_test.go p2p/discover: fix update logic in handleAddNode (#29836) 2024-05-28 21:30:17 +02:00
table_util_test.go p2p/discover: fix crash when revalidated node is removed (#29864) 2024-05-28 18:13:03 +02:00
v4_lookup_test.go p2p/discover: using slices.Contains (#29395) 2024-04-04 12:24:49 +02:00
v4_udp.go p2p/discover: improved node revalidation (#29572) 2024-05-23 14:26:09 +02:00
v4_udp_test.go p2p/discover: improved node revalidation (#29572) 2024-05-23 14:26:09 +02:00
v5_talk.go p2p/discover: concurrent TALKREQ handling (#27112) 2023-04-28 11:03:43 +02:00
v5_udp.go p2p/discover: improved node revalidation (#29572) 2024-05-23 14:26:09 +02:00
v5_udp_test.go p2p/discover: improved node revalidation (#29572) 2024-05-23 14:26:09 +02:00