• Felix Lange's avatar
    p2p/discover: move bond logic from table to transport (#17048) · c73b654f
    Felix Lange authored
    * p2p/discover: move bond logic from table to transport
    
    This commit moves node endpoint verification (bonding) from the table to
    the UDP transport implementation. Previously, adding a node to the table
    entailed pinging the node if needed. With this change, the ping-back
    logic is embedded in the packet handler at a lower level.
    
    It is easy to verify that the basic protocol is unchanged: we still
    require a valid pong reply from the node before findnode is accepted.
    
    The node database tracked the time of last ping sent to the node and
    time of last valid pong received from the node. Node endpoints are
    considered verified when a valid pong is received and the time of last
    pong was called 'bond time'. The time of last ping sent was unused. In
    this commit, the last ping database entry is repurposed to mean last
    ping _received_. This entry is now used to track whether the node needs
    to be pinged back.
    
    The other big change is how nodes are added to the table. We used to add
    nodes in Table.bond, which ran when a remote node pinged us or when we
    encountered the node in a neighbors reply. The transport now adds to the
    table directly after the endpoint is verified through ping. To ensure
    that the Table can't be filled just by pinging the node repeatedly, we
    retain the isInitDone check. During init, only nodes from neighbors
    replies are added.
    
    * p2p/discover: reduce findnode failure counter on success
    
    * p2p/discover: remove unused parameter of loadSeedNodes
    
    * p2p/discover: improve ping-back check and comments
    
    * p2p/discover: add neighbors reply nodes always, not just during init
    c73b654f
Name
Last commit
Last update
.github Loading commit data...
accounts Loading commit data...
build Loading commit data...
cmd Loading commit data...
common Loading commit data...
consensus Loading commit data...
console Loading commit data...
containers/docker Loading commit data...
contracts Loading commit data...
core Loading commit data...
crypto Loading commit data...
dashboard Loading commit data...
eth Loading commit data...
ethclient Loading commit data...
ethdb Loading commit data...
ethstats Loading commit data...
event Loading commit data...
internal Loading commit data...
les Loading commit data...
light Loading commit data...
log Loading commit data...
metrics Loading commit data...
miner Loading commit data...
mobile Loading commit data...
node Loading commit data...
p2p Loading commit data...
params Loading commit data...
rlp Loading commit data...
rpc Loading commit data...
signer Loading commit data...
swarm Loading commit data...
tests Loading commit data...
trie Loading commit data...
vendor Loading commit data...
whisper Loading commit data...
.dockerignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gitmodules Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
AUTHORS Loading commit data...
COPYING Loading commit data...
COPYING.LESSER Loading commit data...
Dockerfile Loading commit data...
Dockerfile.alltools Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
VERSION Loading commit data...
appveyor.yml Loading commit data...
circle.yml Loading commit data...
interfaces.go Loading commit data...