aboutsummaryrefslogtreecommitdiffstats
path: root/peer.go
diff options
context:
space:
mode:
Diffstat (limited to 'peer.go')
-rw-r--r--peer.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/peer.go b/peer.go
index 53fdfa8fc..ed81ddd8e 100644
--- a/peer.go
+++ b/peer.go
@@ -23,6 +23,9 @@ const (
type DiscReason byte
const (
+ // Values are given explicitly instead of by iota because these values are
+ // defined by the wire protocol spec; it is easier for humans to ensure
+ // correctness when values are explicit.
DiscReRequested = 0x00
DiscReTcpSysErr = 0x01
DiscBadProto = 0x02
@@ -56,9 +59,9 @@ func (d DiscReason) String() string {
type Caps byte
const (
- CapPeerDiscTy = 0x01
- CapTxTy = 0x02
- CapChainTy = 0x04
+ CapPeerDiscTy = 1 << iota
+ CapTxTy
+ CapChainTy
CapDefault = CapChainTy | CapTxTy | CapPeerDiscTy
)
@@ -285,7 +288,6 @@ func (p *Peer) HandleInbound() {
p.lastPong = time.Now().Unix()
case ethwire.MsgBlockTy:
// Get all blocks and process them
- msg.Data = msg.Data
var block, lastBlock *ethchain.Block
var err error
for i := msg.Data.Len() - 1; i >= 0; i-- {
@@ -438,7 +440,7 @@ func (p *Peer) Start() {
err := p.pushHandshake()
if err != nil {
- log.Printf("Peer can't send outbound version ack", err)
+ log.Println("Peer can't send outbound version ack", err)
p.Stop()