From 1ecfd0dd681768e7577c42c30701473833d027d3 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 1 Jul 2019 08:34:44 +0300 Subject: [PATCH] Update ethereum to include dialer fix --- go.mod | 2 +- go.sum | 4 ++-- vendor/github.com/ethereum/go-ethereum/p2p/dial.go | 13 +++++++++++++ .../github.com/ethereum/go-ethereum/p2p/server.go | 1 + vendor/modules.txt | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index b2f6e03..de985e9 100644 --- a/go.mod +++ b/go.mod @@ -55,4 +55,4 @@ require ( gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190213234257-ec84240a7772 // indirect ) -replace github.com/ethereum/go-ethereum v1.8.27 => github.com/status-im/go-ethereum v1.8.27-status +replace github.com/ethereum/go-ethereum v1.8.27 => github.com/status-im/go-ethereum v1.8.27-status.4 diff --git a/go.sum b/go.sum index 80d2c76..ed5374d 100644 --- a/go.sum +++ b/go.sum @@ -499,8 +499,8 @@ github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2 github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/status-im/doubleratchet v2.0.0+incompatible h1:s77lF1lDubK0RKftxN2vH8G9gwtVVp13ggWfyY4O1q4= github.com/status-im/doubleratchet v2.0.0+incompatible/go.mod h1:1sqR0+yhiM/bd+wrdX79AOt2csZuJOni0nUDzKNuqOU= -github.com/status-im/go-ethereum v1.8.27-status h1:QHUPjJeZHQcgqDJ9nyJDl1u2hzAw8NDtACYGNJg+w6I= -github.com/status-im/go-ethereum v1.8.27-status/go.mod h1:Ulij8LMpMvXnbnPcmDqrpI+iXoXSjxItuY/wmbasTZU= +github.com/status-im/go-ethereum v1.8.27-status.4 h1:8jTQsYDLtKd/XCa++ZkexTPHfANIDh084JbO2SBAwp4= +github.com/status-im/go-ethereum v1.8.27-status.4/go.mod h1:Ulij8LMpMvXnbnPcmDqrpI+iXoXSjxItuY/wmbasTZU= github.com/status-im/go-multiaddr-ethv4 v1.1.0 h1:7+BdGNaqb66f/dO7mx/12LjaT+6wr4G8l4wvkONfctg= github.com/status-im/go-multiaddr-ethv4 v1.1.0/go.mod h1:H/WC6o3//elWzBWBe/UhvLl4tqtseVLzO5SFNBtT5SU= github.com/status-im/migrate v3.5.1-status+incompatible h1:MhM/sOyGDrWMkJxamqc9AA3atDXC/RDJzyMJ8XDL3Yg= diff --git a/vendor/github.com/ethereum/go-ethereum/p2p/dial.go b/vendor/github.com/ethereum/go-ethereum/p2p/dial.go index 075a0f9..bdaa11a 100644 --- a/vendor/github.com/ethereum/go-ethereum/p2p/dial.go +++ b/vendor/github.com/ethereum/go-ethereum/p2p/dial.go @@ -198,6 +198,9 @@ func (s *dialstate) newTasks(nRunning int, peers map[enode.ID]*Peer, now time.Ti case errNotWhitelisted, errSelf: log.Warn("Removing static dial candidate", "id", t.dest.ID, "addr", &net.TCPAddr{IP: t.dest.IP(), Port: t.dest.TCP()}, "err", err) delete(s.static, t.dest.ID()) + case errRecentlyDialed: + expiry := s.hist.expiry(t.dest.ID()) + log.Debug("peer was recently dialed", "enode", t.dest.String(), "expires at", expiry, "after", expiry.Sub(time.Now())) case nil: s.dialing[id] = t.flags newtasks = append(newtasks, t) @@ -411,6 +414,16 @@ func (h dialHistory) contains(id enode.ID) bool { } return false } + +func (h dialHistory) expiry(id enode.ID) time.Time { + for _, v := range h { + if v.id == id { + return v.exp + } + } + return time.Time{} +} + func (h *dialHistory) expire(now time.Time) { for h.Len() > 0 && h.min().exp.Before(now) { heap.Pop(h) diff --git a/vendor/github.com/ethereum/go-ethereum/p2p/server.go b/vendor/github.com/ethereum/go-ethereum/p2p/server.go index 43db1be..2fbfe77 100644 --- a/vendor/github.com/ethereum/go-ethereum/p2p/server.go +++ b/vendor/github.com/ethereum/go-ethereum/p2p/server.go @@ -693,6 +693,7 @@ running: // ephemeral static peer list. Add it to the dialer, // it will keep the node connected. srv.log.Trace("Adding static node", "node", n) + dialstate.removeStatic(n) dialstate.addStatic(n) case n := <-srv.removestatic: // This channel is used by RemovePeer to send a diff --git a/vendor/modules.txt b/vendor/modules.txt index 4a47e23..245b0ae 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -22,7 +22,7 @@ github.com/davecgh/go-spew/spew github.com/deckarep/golang-set # github.com/edsrzf/mmap-go v1.0.0 github.com/edsrzf/mmap-go -# github.com/ethereum/go-ethereum v1.8.27 => github.com/status-im/go-ethereum v1.8.27-status +# github.com/ethereum/go-ethereum v1.8.27 => github.com/status-im/go-ethereum v1.8.27-status.4 github.com/ethereum/go-ethereum/common github.com/ethereum/go-ethereum/crypto github.com/ethereum/go-ethereum/node