aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/peer.go
diff options
context:
space:
mode:
Diffstat (limited to 'eth/downloader/peer.go')
-rw-r--r--eth/downloader/peer.go10
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 {