diff options
author | Péter Szilágyi <peterke@gmail.com> | 2015-06-04 19:51:14 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2015-06-04 19:51:14 +0800 |
commit | 28c32d1b1bc9ed687713aa4de4eaab38d2a4cb08 (patch) | |
tree | 3747e7ea7d0a88bcaf604f4fd7870a8b0264f9ae /eth/downloader/peer.go | |
parent | 861031491860c69f29e1444c22dd84c38abfedf4 (diff) | |
download | dexon-28c32d1b1bc9ed687713aa4de4eaab38d2a4cb08.tar.gz dexon-28c32d1b1bc9ed687713aa4de4eaab38d2a4cb08.tar.zst dexon-28c32d1b1bc9ed687713aa4de4eaab38d2a4cb08.zip |
eth/downloader: fix #1178, don't request blocks beyond the cache bounds
Diffstat (limited to 'eth/downloader/peer.go')
-rw-r--r-- | eth/downloader/peer.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/eth/downloader/peer.go b/eth/downloader/peer.go index 8ef017df7..2b3f8798e 100644 --- a/eth/downloader/peer.go +++ b/eth/downloader/peer.go @@ -5,6 +5,7 @@ package downloader import ( "errors" + "fmt" "math" "sync" "sync/atomic" @@ -135,6 +136,15 @@ func (p *peer) Demote() { } } +// String implements fmt.Stringer. +func (p *peer) String() string { + return fmt.Sprintf("Peer %s [%s]", p.id, + fmt.Sprintf("reputation %3d, ", atomic.LoadInt32(&p.rep))+ + fmt.Sprintf("capacity %3d, ", atomic.LoadInt32(&p.capacity))+ + fmt.Sprintf("ignored %4d", p.ignored.Size()), + ) +} + // peerSet represents the collection of active peer participating in the block // download procedure. type peerSet struct { |