Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geth v1.9.11 #17

Closed
wants to merge 165 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
00e0056
Write state diff to CSV (#2)
elizabethengelman Jan 28, 2019
837a66a
Apply go fmt changes to statediff
elizabethengelman Jan 30, 2019
ddb53ad
Apply goimports to statediff
elizabethengelman Jan 31, 2019
db01237
Apply gosimple changes to statediff
elizabethengelman Jan 31, 2019
2f34966
Gracefully exit geth command(#4)
elizabethengelman Feb 11, 2019
2b68430
Statediff for full node (#6)
elizabethengelman Feb 21, 2019
e18f462
refactoring/reorganizing packages
i-norden Apr 26, 2019
df1bfba
refactoring statediff builder and types and adjusted to relay proofs …
i-norden Apr 26, 2019
e69ab97
refactoring state diff service and adding api which allows for stream…
i-norden Apr 26, 2019
4e8d812
make proofs and paths optional + compress service loop into single fo…
i-norden May 13, 2019
adf43ec
option to process intermediate nodes
i-norden May 15, 2019
2cf3403
make state diff rlp serializable
i-norden May 16, 2019
ea34704
cli parameter to limit statediffing to select account addresses + test
i-norden May 17, 2019
bed68d4
review fixes and fixes for issues ran into in integration
i-norden May 17, 2019
f682030
review fixes; proper method signature for api; adjust service so that…
i-norden Jun 5, 2019
7096c9c
adjust buffering to improve stability; doc.go; fix notifier
i-norden Jun 7, 2019
a87a06f
relay receipts with the rest of the data + review fixes/changes
i-norden Jul 18, 2019
8c2f200
core: add blockchain test too for revert cornercase
holiman Sep 16, 2019
e00e187
params: release Geth v1.9.7
karalabe Nov 7, 2019
92e94dc
params: begin v1.9.8 release cycle
karalabe Nov 7, 2019
03a3783
p2p/enode: mock DNS resolver in URL parsing test (#20252)
fjl Nov 7, 2019
8a6bd87
travis: enable test suite on ARM64 (#20219)
gballet Nov 8, 2019
8489a29
p2p: fix bug in TestPeerDisconnect (#20277)
Nov 13, 2019
539ca8c
dashboard: send current block to the dashboard client (#19762)
kurkomisi Nov 13, 2019
ff0b463
miner: increase worker test timeout (#20268)
gballet Nov 13, 2019
c255367
les: implement server priority API (#20070)
zsfelfoldi Nov 13, 2019
e2482ae
accounts/abi/bind, cmd/abigen: implement alias for abigen (#20244)
rjl493456442 Nov 14, 2019
a672c10
rpc: fix typo example code (#20284)
Jorropo Nov 14, 2019
e2198a1
cmd/faucet: use github.com/gorilla/websocket (#20283)
fjl Nov 14, 2019
6329ba8
dashboard: remove the dashboard (#20279)
fjl Nov 14, 2019
a747953
whisper/whisperv6: fix staticcheck issues (#20288)
gballet Nov 14, 2019
0e3e967
build: gather info to investigate why builds fail on ARM (#20281)
gballet Nov 14, 2019
3c889e7
params: finish sentence in comment (#20291)
meowsbits Nov 14, 2019
d946ff0
core/vm: fix tracer interface parameter name (#20294)
nebojsa94 Nov 15, 2019
cc86617
internal/ethapi: don't query wallets at every execution of gas estima…
holiman Nov 11, 2019
3c1fbf9
cmd/evm: Allow loading input from file (#20273)
michaelforney Nov 17, 2019
f3fa942
rpc, p2p/simulations: use github.com/gorilla/websocket (#20289)
fjl Nov 18, 2019
cb1ba11
build: use golangci-lint (#20295)
fjl Nov 18, 2019
ef27606
travis: remove traces and use travis_wait in ARM build (#20296)
gballet Nov 18, 2019
3e06a55
core: s/isEIP155/isHomestead/g (fix IntrinsicGas signature var name) …
meowsbits Nov 18, 2019
4f9d21d
les: rename UpdateBalance to AddBalance and simplify return format (#…
zsfelfoldi Nov 18, 2019
0f3164d
travis: use travis_wait for both install and build (#20309)
gballet Nov 18, 2019
efc8f80
build: add test cmd flag -v for verbose logs (#20298)
meowsbits Nov 18, 2019
38888ac
cmd/clef: fix staticcheck warnings (#20314)
fjl Nov 18, 2019
40a8484
consensus/clique: add clique_status API method (#20103)
holiman Nov 18, 2019
5fd9461
consensus/clique: fix struct tags for status API (#20316)
fjl Nov 18, 2019
db93da5
cmd/ethkey: fix file permissions in changepassword command (#20313)
fjl Nov 19, 2019
756ed51
p2p/netutil: fix staticcheck warning (#20315)
fjl Nov 19, 2019
a2ea532
core/rawdb: check hash before return data from ancient db (#20195)
rjl493456442 Nov 19, 2019
c0428c4
travis: deactivate arm build during push (#20321)
gballet Nov 19, 2019
7364229
ethclient: remove use of common.ToHex (#20326)
fjl Nov 19, 2019
b1e2868
cmd/wnode: remove uses of common.ToHex (#20327)
fjl Nov 19, 2019
88e5154
event: remove unused field 'closed' (#20324)
fjl Nov 19, 2019
2153dbe
.github: remove 'nonsense' from CODEOWNERS (#20329)
gballet Nov 19, 2019
b01dccb
whisper/whisperv6: fix staticcheck warnings (#20328)
fjl Nov 19, 2019
2b8f3c4
p2p: remove unused code (#20325)
fjl Nov 19, 2019
67e9f39
p2p/simulations: fix staticcheck warnings (#20322)
fjl Nov 19, 2019
81d1bfd
internal/web3ext, les: update clique JS and make it work with the lig…
fjl Nov 19, 2019
06df38e
rpc: remove 'exported or builtin' restriction for parameters (#20332)
fjl Nov 20, 2019
0cc6974
core: fix staticcheck warnings (#20323)
fjl Nov 20, 2019
af3806f
miner: fix data race in tests (#20310)
rjl493456442 Nov 20, 2019
01a6254
cmd/puppeth: update chain spec of parity (#20241)
rjl493456442 Nov 20, 2019
46496e8
go.mod, vendor: switch to Go modules
karalabe Nov 18, 2019
93bb6c3
travis: explicitly enable go modules in Go 1.11 and 1.12
karalabe Nov 18, 2019
0e8c205
accounts/abi/bind: switch binding test to go modules
karalabe Nov 18, 2019
f19cbb0
travis, build: aggregate and upload go mod dependencies for PPA
karalabe Nov 18, 2019
f024339
go.mod: tidy up the modules to avoid xgo writes to go.sum
karalabe Nov 18, 2019
d83c9fa
build, internal/build: drop own file/folder copier
karalabe Nov 18, 2019
6f31c1f
travis: fake build ppa only for go module dependencies
karalabe Nov 18, 2019
fbc3611
mobile: fix CopyFile switch to package cp
karalabe Nov 18, 2019
c1dabf8
tests: refactor TestState to dedupe walk callback
meowsbits Nov 20, 2019
1887cd7
build, travis: use ephemeral debsrc GOPATH to get mod deps
karalabe Nov 20, 2019
3383739
tests: enable TransactionTests Istanbul case (#20337)
meowsbits Nov 20, 2019
13b28f7
cmd/puppeth: x-spec nonce data type, use types.BlockNonce
meowsbits Nov 20, 2019
419268f
cmd/puppeth: make ssh prompt more user-friendly
holiman Nov 21, 2019
62d423f
common/hexutil: improve GraphQL error messages (#20353)
fjl Nov 21, 2019
3d46043
build: pull in ci.go dependencies for the PPA builder
karalabe Nov 21, 2019
6ccf0a7
common: improve GraphQL error messages (#20354)
fjl Nov 21, 2019
d58ad8d
core/types: remove BlockBy sorting code (#20355)
fjl Nov 21, 2019
7be6449
build: skip go clean on PPA, messes with the module trick
karalabe Nov 21, 2019
76efa96
accounts/abi/bind/backends: remove unused assignment (#20359)
fjl Nov 21, 2019
9fa5359
accounts/abi: fix staticcheck warnings (#20358)
fjl Nov 21, 2019
4c2ce94
core/state: fix staticcheck warnings (#20357)
fjl Nov 22, 2019
747e449
metrics: fix issues reported by staticcheck (#20365)
gballet Nov 22, 2019
30af43f
trie: remove unused code (#20366)
fjl Nov 22, 2019
31cec2a
p2p/discv5: add deprecation warning and remove unused code (#20367)
fjl Nov 22, 2019
eaf136e
tests, signer: remove staticcheck warnings (#20364)
gballet Nov 23, 2019
fca48e2
core/asm: allow numbers in labels (#20362)
michaelforney Nov 23, 2019
d6a0772
miner: fix staticcheck warnings (#20375)
gballet Nov 24, 2019
e3f2545
eth/tracers: fix staticcheck warnings (#20379)
gballet Nov 24, 2019
ab5e0e3
trie: replace bigcache with fastcache (#19971)
rjl493456442 Nov 25, 2019
8e35276
cmd/geth: remove network id from version cmd
meowsbits Nov 25, 2019
397c3e2
rlp: fix staticcheck warnings (#20368)
fjl Nov 25, 2019
0d3bcbb
accounts/abi/bind: avoid reclaring structs (#20381)
rjl493456442 Nov 25, 2019
809a085
accounts/keystore: fix staticcheck warnings (#20373)
gballet Nov 25, 2019
070afb0
p2p/discover: slow down lookups on empty table (#20389)
fjl Nov 26, 2019
946f889
les: fix clientInfo deadlock (#20395)
zsfelfoldi Nov 26, 2019
572d244
params: release go-ethereum v1.9.8
karalabe Nov 26, 2019
3b549fa
params: begin v1.9.9 release cycle
karalabe Nov 26, 2019
d534abf
cmd: fix command help messages in modules (#20203)
zacscoding Nov 26, 2019
3784499
les: fix staticcheck warnings (#20371)
gballet Nov 27, 2019
0046347
core: fix staticcheck warnings (#20384)
gballet Nov 27, 2019
e7a06d5
core/rawdb: fix reinit regression caused by the hash check PR
karalabe Nov 27, 2019
9c04887
deps: update fastcache to 1.5.3
holiman Nov 27, 2019
b41940f
consensus/ethash: refactor remote sealer (#20335)
fjl Nov 28, 2019
e6f0294
log: fix staticcheck warnings (#20388)
gballet Nov 28, 2019
44e7bec
trie: remove dead code (#20405)
rjl493456442 Nov 28, 2019
376e876
cmd/faucet, cmd/geth: fix staticcheck warnings (#20374)
gballet Nov 29, 2019
84ce2ed
internal: fix staticcheck warnings (#20380)
gballet Nov 29, 2019
98e0b8c
accounts/scwallet: fix staticcheck warnings (#20370)
gballet Nov 29, 2019
05b3c16
internal/web3ext: add debug_accountRange (#20410)
xinluyin Nov 29, 2019
db26dfc
accounts/usbwallet: fix staticcheck warnings (#20372)
gballet Nov 29, 2019
72e8fb3
core, miner: remove PostChainEvents (#19396)
rjl493456442 Nov 29, 2019
091e9db
accounts/abi/bind: fix destructive packing of *big.Int (#20412)
MariusVanDerWijden Dec 2, 2019
4c4e8e8
trie: track dirty cache metrics, track clean writes on commit
karalabe Dec 2, 2019
0c7ae69
params: update CHTs for v1.9.9 release
karalabe Dec 5, 2019
04998d1
p2p/enode: remove data race in sliceIter (#20421)
MariusVanDerWijden Dec 5, 2019
e142beb
consensus/ethash, params: eip-2384: bump difficulty bomb (#20347)
holiman Dec 6, 2019
4a2e08d
params: release Geth v1.9.9
karalabe Dec 6, 2019
844ed25
Update test block hashes
elizabethengelman Dec 20, 2019
ed2bc05
Cleanup after rebasing v1.9.9
elizabethengelman Dec 20, 2019
d66903b
Add warning to statediff docs that empty payloads may be sent to sub
elizabethengelman Jan 27, 2020
95203db
Merge pull request #4 from makerdao/statediffing-service
Jan 28, 2020
6ab17fc
Merge pull request #7 from makerdao/statediff-check
Jan 28, 2020
4cc89a5
internal/build: don't crash in DownloadFile when offline (#20595)
fjl Feb 3, 2020
5a9c964
trie: separate hashes and committer, collapse on commit
holiman Feb 3, 2020
33791db
tracers: avoid panic on invalid arguments (#20612)
tintinweb Feb 4, 2020
058a4ac
core/evm: less iteration in blockhash (#20589)
holiman Feb 4, 2020
711ed74
cmd/geth: add 'dumpgenesis' command (#20191)
meowsbits Feb 4, 2020
a1313b5
trie: make hasher parallel when number of changes are large (#20488)
holiman Feb 4, 2020
976a0f5
cmd/devp2p: fix Route53 TXT record splitting (#20626)
fjl Feb 5, 2020
4a231cd
internal/ethapi: return non-null "number" for pending block (#20616)
holiman Feb 7, 2020
675f4e7
README.md: update evm usage example (#20635)
wolflo Feb 9, 2020
34bb132
graphql: add transaction signature values (#20623)
AmitBRD Feb 9, 2020
172f777
rpc: add error when call result parameter is not addressable (#20638)
adamschmideg Feb 11, 2020
8694d14
signer: add bytes32 as valid primitive (#20609)
chabashilah Feb 11, 2020
dcffb77
cmd/geth retesteth: add eth_getBlockByHash (#20621)
winsvega Feb 11, 2020
049e171
core, eth: implement eth/65 transaction fetcher
rjl493456442 Oct 28, 2019
c22fdec
common/mclock: add NewTimer and Timer.Reset (#20634)
fjl Feb 11, 2020
8045504
les: log disconnect reason when light server is not synced (#20643)
adamschmideg Feb 11, 2020
1821328
event: add missing unlock before panic (#20653)
Feb 12, 2020
46c4b69
accounts/abi/bind/backends: add support for historical state (#20644)
MariusVanDerWijden Feb 12, 2020
a9614c3
event, p2p/simulations/adapters: fix rare goroutine leaks (#20657)
Feb 12, 2020
5f2002b
accounts: add walletsNoLock to avoid double read lock (#20655)
Feb 12, 2020
90caa2c
p2p: new dial scheduler (#20592)
fjl Feb 13, 2020
9938d95
eth: rework tx fetcher to use O(1) ops + manage network requests
karalabe Jan 22, 2020
eddcecc
Merge pull request #20234 from rjl493456442/newtxhashes_2
karalabe Feb 13, 2020
38d1b0c
cmd/geth: enable DNS discovery by default (#20660)
fjl Feb 13, 2020
8556905
core: ensure state exists for prefetcher (#20627)
holiman Feb 14, 2020
37531b1
cmd/faucet: protect f.reqs with Rlock to prevent data race (#20669)
BurtonQin Feb 15, 2020
36a1e0b
eth: don't enforce minimum broadcast, fix broadcast test
karalabe Feb 17, 2020
fef8c98
travis, appveyor, build: bump builder Go to 1.13.8
karalabe Feb 17, 2020
26284ec
Merge pull request #20681 from karalabe/go1.13.8
karalabe Feb 17, 2020
ac72787
p2p: remove MeteredPeerEvent (#20679)
fjl Feb 17, 2020
1c4c486
cmd/ethkey: speed up test by using weaker scrypt parameters (#20680)
fjl Feb 17, 2020
c211798
Merge pull request #20678 from karalabe/broadcast-sqrt-proper
karalabe Feb 17, 2020
57d4898
p2p/dnsdisc: re-check tree root when leaf resolution fails (#20682)
fjl Feb 17, 2020
1b9c5b3
all: fix goroutine leaks in unit tests by adding 1-elem channel buffe…
BurtonQin Feb 17, 2020
91b2289
rpc: remove startup error for invalid modules, log it instead (#20684)
fjl Feb 17, 2020
4f55e24
params: update CHTs for the v1.9.11 release
karalabe Feb 18, 2020
05ccbb5
Merge pull request #20687 from karalabe/cht-1.9.11
karalabe Feb 18, 2020
dae3aee
les: add bootstrap nodes as initial discoveries (#20688)
fjl Feb 18, 2020
6a62fe3
params: release Geth v1.9.11 stable
karalabe Feb 18, 2020
b808126
Merge commit '6a62fe399b68ab9e3625ef5e7900394f389adc3a' into geth-v1.…
yaoandrew Feb 21, 2020
60bb77b
Clean up after merge
yaoandrew Feb 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
p2p/dnsdisc: re-check tree root when leaf resolution fails (ethereum#…
…20682)

This adds additional logic to re-resolve the root name of a tree when a
couple of leaf requests have failed. We need this change to avoid
getting into a failure state where leaf requests keep failing for half
an hour when the tree has been updated.
  • Loading branch information
fjl authored Feb 17, 2020
commit 57d4898e2992a46fc2deab93a2666a2979b6704c
66 changes: 57 additions & 9 deletions p2p/dnsdisc/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package dnsdisc
import (
"context"
"crypto/ecdsa"
"errors"
"math/rand"
"reflect"
"testing"
Expand Down Expand Up @@ -176,11 +177,62 @@ func TestIteratorNodeUpdates(t *testing.T) {
t.Fatal(err)
}

// sync the original tree.
// Sync the original tree.
resolver.add(tree1.ToTXT("n"))
checkIterator(t, it, nodes[:25])

// Update some nodes and ensure RandomNode returns the new nodes as well.
// Ensure RandomNode returns the new nodes after the tree is updated.
updateSomeNodes(nodesSeed1, nodes)
tree2, _ := makeTestTree("n", nodes, nil)
resolver.clear()
resolver.add(tree2.ToTXT("n"))
t.Log("tree updated")

clock.Run(c.cfg.RecheckInterval + 1*time.Second)
checkIterator(t, it, nodes)
}

// This test checks that the tree root is rechecked when a couple of leaf
// requests have failed. The test is just like TestIteratorNodeUpdates, but
// without advancing the clock by recheckInterval after the tree update.
func TestIteratorRootRecheckOnFail(t *testing.T) {
var (
clock = new(mclock.Simulated)
nodes = testNodes(nodesSeed1, 30)
resolver = newMapResolver()
c = NewClient(Config{
Resolver: resolver,
Logger: testlog.Logger(t, log.LvlTrace),
RecheckInterval: 20 * time.Minute,
RateLimit: 500,
// Disabling the cache is required for this test because the client doesn't
// notice leaf failures if all records are cached.
CacheLimit: 1,
})
)
c.clock = clock
tree1, url := makeTestTree("n", nodes[:25], nil)
it, err := c.NewIterator(url)
if err != nil {
t.Fatal(err)
}

// Sync the original tree.
resolver.add(tree1.ToTXT("n"))
checkIterator(t, it, nodes[:25])

// Ensure RandomNode returns the new nodes after the tree is updated.
updateSomeNodes(nodesSeed1, nodes)
tree2, _ := makeTestTree("n", nodes, nil)
resolver.clear()
resolver.add(tree2.ToTXT("n"))
t.Log("tree updated")

checkIterator(t, it, nodes)
}

// updateSomeNodes applies ENR updates to some of the given nodes.
func updateSomeNodes(keySeed int64, nodes []*enode.Node) {
keys := testKeys(nodesSeed1, len(nodes))
for i, n := range nodes[:len(nodes)/2] {
r := n.Record()
Expand All @@ -190,11 +242,6 @@ func TestIteratorNodeUpdates(t *testing.T) {
n2, _ := enode.New(enode.ValidSchemes, r)
nodes[i] = n2
}
tree2, _ := makeTestTree("n", nodes, nil)
clock.Run(c.cfg.RecheckInterval + 1*time.Second)
resolver.clear()
resolver.add(tree2.ToTXT("n"))
checkIterator(t, it, nodes)
}

// This test verifies that randomIterator re-checks the root of the tree to catch
Expand Down Expand Up @@ -230,9 +277,10 @@ func TestIteratorLinkUpdates(t *testing.T) {
// Add link to tree3, remove link to tree2.
tree1, _ = makeTestTree("t1", nodes[:10], []string{url3})
resolver.add(tree1.ToTXT("t1"))
clock.Run(c.cfg.RecheckInterval + 1*time.Second)
t.Log("tree1 updated")

clock.Run(c.cfg.RecheckInterval + 1*time.Second)

var wantNodes []*enode.Node
wantNodes = append(wantNodes, tree1.Nodes()...)
wantNodes = append(wantNodes, tree3.Nodes()...)
Expand Down Expand Up @@ -345,5 +393,5 @@ func (mr mapResolver) LookupTXT(ctx context.Context, name string) ([]string, err
if record, ok := mr[name]; ok {
return []string{record}, nil
}
return nil, nil
return nil, errors.New("not found")
}
65 changes: 56 additions & 9 deletions p2p/dnsdisc/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,22 @@ import (
"github.com/ethereum/go-ethereum/p2p/enode"
)

const (
rootRecheckFailCount = 5 // update root if this many leaf requests fail
)

// clientTree is a full tree being synced.
type clientTree struct {
c *Client
loc *linkEntry // link to this tree

lastRootCheck mclock.AbsTime // last revalidation of root
root *rootEntry
enrs *subtreeSync
links *subtreeSync
leafFailCount int
rootFailCount int

root *rootEntry
enrs *subtreeSync
links *subtreeSync

lc *linkCache // tracks all links between all trees
curLinks map[string]struct{} // links contained in this tree
Expand All @@ -46,7 +53,7 @@ func newClientTree(c *Client, lc *linkCache, loc *linkEntry) *clientTree {

// syncAll retrieves all entries of the tree.
func (ct *clientTree) syncAll(dest map[string]entry) error {
if err := ct.updateRoot(); err != nil {
if err := ct.updateRoot(context.Background()); err != nil {
return err
}
if err := ct.links.resolveAll(dest); err != nil {
Expand All @@ -60,12 +67,20 @@ func (ct *clientTree) syncAll(dest map[string]entry) error {

// syncRandom retrieves a single entry of the tree. The Node return value
// is non-nil if the entry was a node.
func (ct *clientTree) syncRandom(ctx context.Context) (*enode.Node, error) {
func (ct *clientTree) syncRandom(ctx context.Context) (n *enode.Node, err error) {
if ct.rootUpdateDue() {
if err := ct.updateRoot(); err != nil {
if err := ct.updateRoot(ctx); err != nil {
return nil, err
}
}

// Update fail counter for leaf request errors.
defer func() {
if err != nil {
ct.leafFailCount++
}
}()

// Link tree sync has priority, run it to completion before syncing ENRs.
if !ct.links.done() {
err := ct.syncNextLink(ctx)
Expand Down Expand Up @@ -138,15 +153,22 @@ func removeHash(h []string, index int) []string {
}

// updateRoot ensures that the given tree has an up-to-date root.
func (ct *clientTree) updateRoot() error {
func (ct *clientTree) updateRoot(ctx context.Context) error {
if !ct.slowdownRootUpdate(ctx) {
return ctx.Err()
}

ct.lastRootCheck = ct.c.clock.Now()
ctx, cancel := context.WithTimeout(context.Background(), ct.c.cfg.Timeout)
ctx, cancel := context.WithTimeout(ctx, ct.c.cfg.Timeout)
defer cancel()
root, err := ct.c.resolveRoot(ctx, ct.loc)
if err != nil {
ct.rootFailCount++
return err
}
ct.root = &root
ct.rootFailCount = 0
ct.leafFailCount = 0

// Invalidate subtrees if changed.
if ct.links == nil || root.lroot != ct.links.root {
Expand All @@ -161,7 +183,32 @@ func (ct *clientTree) updateRoot() error {

// rootUpdateDue returns true when a root update is needed.
func (ct *clientTree) rootUpdateDue() bool {
return ct.root == nil || time.Duration(ct.c.clock.Now()-ct.lastRootCheck) > ct.c.cfg.RecheckInterval
tooManyFailures := ct.leafFailCount > rootRecheckFailCount
scheduledCheck := ct.c.clock.Now().Sub(ct.lastRootCheck) > ct.c.cfg.RecheckInterval
return ct.root == nil || tooManyFailures || scheduledCheck
}

// slowdownRootUpdate applies a delay to root resolution if is tried
// too frequently. This avoids busy polling when the client is offline.
// Returns true if the timeout passed, false if sync was canceled.
func (ct *clientTree) slowdownRootUpdate(ctx context.Context) bool {
var delay time.Duration
switch {
case ct.rootFailCount > 20:
delay = 10 * time.Second
case ct.rootFailCount > 5:
delay = 5 * time.Second
default:
return true
}
timeout := ct.c.clock.NewTimer(delay)
defer timeout.Stop()
select {
case <-timeout.C():
return true
case <-ctx.Done():
return false
}
}

// subtreeSync is the sync of an ENR or link subtree.
Expand Down