aboutsummaryrefslogtreecommitdiffstats
path: root/peer.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-02-19 18:40:02 +0800
committerobscuren <geffobscura@gmail.com>2014-02-19 18:40:02 +0800
commit0936e5ccf5c8fc842cbd135c02a6abcd009b4e7f (patch)
tree9c867dbb5061be01bb040f9bafcf12236679383e /peer.go
parent24f2b2afc3a848190822c382e6aa31c8ab120f07 (diff)
parent531b3a96ebc408c00f67cee00ebe7fe192bf0b8c (diff)
downloadgo-tangerine-0936e5ccf5c8fc842cbd135c02a6abcd009b4e7f.tar.gz
go-tangerine-0936e5ccf5c8fc842cbd135c02a6abcd009b4e7f.tar.zst
go-tangerine-0936e5ccf5c8fc842cbd135c02a6abcd009b4e7f.zip
Merge branch 'develop' of github.com-obscure:ethereum/eth-go into develop
Conflicts: ethutil/config.go
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()