aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/discover/database_test.go
Commit message (Collapse)AuthorAgeFilesLines
* p2p/discover: move bond logic from table to transport (#17048)Felix Lange2018-07-031-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* p2p/discover: s/lastPong/bondTime/, update TestUDP_findnodeFelix Lange2018-02-171-9/+9
| | | | | | | I forgot to change the check in udp.go when I changed Table.bond to be based on lastPong instead of node presence in db. Rename lastPong to bondTime and add hasBond so it's clearer what this DB key is used for now.
* all: gofmt -w -sFelix Lange2017-01-061-2/+2
|
* p2p/discover: support incomplete node URLs, add ResolveFelix Lange2015-12-181-8/+8
|
* p2p/discover: fix race involving the seed node iteratorFelix Lange2015-09-301-66/+37
| | | | | | | | | | | | | | | | | | | nodeDB.querySeeds was not safe for concurrent use but could be called concurrenty on multiple goroutines in the following case: - the table was empty - a timed refresh started - a lookup was started and initiated refresh These conditions are unlikely to coincide during normal use, but are much more likely to occur all at once when the user's machine just woke from sleep. The root cause of the issue is that querySeeds reused the same leveldb iterator until it was exhausted. This commit moves the refresh scheduling logic into its own goroutine (so only one refresh is ever active) and changes querySeeds to not use a persistent iterator. The seed node selection is now more random and ignores nodes that have not been contacted in the last 5 days.
* all: fix license headers one more timeFelix Lange2015-07-241-1/+1
| | | | I forgot to update one instance of "go-ethereum" in commit 3f047be5a.
* all: update license headers to distiguish GPL/LGPLFelix Lange2015-07-231-4/+4
| | | | | All code outside of cmd/ is licensed as LGPL. The headers now reflect this by calling the whole work "the go-ethereum library".
* all: update license informationFelix Lange2015-07-071-0/+16
|
* p2p/discover: add support for counting findnode failuresPéter Szilágyi2015-05-271-0/+11
|
* p2p/discover: fix #838, evacuate self entries from the node dbPéter Szilágyi2015-05-221-8/+65
|
* p2p/discover: fix database presistency test folderPéter Szilágyi2015-05-221-3/+3
|
* p2p/discover: track sha3(ID) in NodeFelix Lange2015-04-301-31/+41
|
* p2p/discover: new endpoint formatFelix Lange2015-04-301-4/+6
| | | | | | This commit changes the discovery protocol to use the new "v4" endpoint format, which allows for separate UDP and TCP ports and makes it possible to discover the UDP address after NAT.
* p2p/discover: add node expirer and related testsPéter Szilágyi2015-04-271-0/+47
|
* p2p/discover: parametrize nodedb version, add persistency testsPéter Szilágyi2015-04-271-4/+55
|
* p2p/discover: use iterator based seeding, drop old protocol testPéter Szilágyi2015-04-271-16/+95
|
* p2p/discover: write the basic tests, catch RLP bugPéter Szilágyi2015-04-271-0/+136