diff options
author | obscuren <geffobscura@gmail.com> | 2014-09-23 01:34:49 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-09-23 01:34:49 +0800 |
commit | df30588eb61b423a60d805b3d68d5a4e556e2a87 (patch) | |
tree | ac183aa3312a4589cb3e4995cc103cfa58ef95da /peer.go | |
parent | b65f29f8faa20a93bd83c18232326c935cb16981 (diff) | |
parent | 7d08e4f7d14600ee4ed38fc9d435e9c2e0e0fdac (diff) | |
download | dexon-df30588eb61b423a60d805b3d68d5a4e556e2a87.tar dexon-df30588eb61b423a60d805b3d68d5a4e556e2a87.tar.gz dexon-df30588eb61b423a60d805b3d68d5a4e556e2a87.tar.bz2 dexon-df30588eb61b423a60d805b3d68d5a4e556e2a87.tar.lz dexon-df30588eb61b423a60d805b3d68d5a4e556e2a87.tar.xz dexon-df30588eb61b423a60d805b3d68d5a4e556e2a87.tar.zst dexon-df30588eb61b423a60d805b3d68d5a4e556e2a87.zip |
Merge branch 'release/0.6.5' into develop
Diffstat (limited to 'peer.go')
-rw-r--r-- | peer.go | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -362,22 +362,24 @@ clean: } func formatMessage(msg *ethwire.Msg) (ret string) { - ret = fmt.Sprintf("%v ", msg.Type) + ret = fmt.Sprintf("%v %v", msg.Type, msg.Data) /* XXX Commented out because I need the log level here to determine if i should or shouldn't generate this message */ - switch msg.Type { - case ethwire.MsgPeersTy: - ret += fmt.Sprintf("(%d entries)", msg.Data.Len()) - case ethwire.MsgBlockTy: - b1, b2 := ethchain.NewBlockFromRlpValue(msg.Data.Get(0)), ethchain.NewBlockFromRlpValue(msg.Data.Get(msg.Data.Len()-1)) - ret += fmt.Sprintf("(%d entries) %x - %x", msg.Data.Len(), b1.Hash()[0:4], b2.Hash()[0:4]) - case ethwire.MsgBlockHashesTy: - h1, h2 := msg.Data.Get(0).Bytes(), msg.Data.Get(msg.Data.Len()-1).Bytes() - ret += fmt.Sprintf("(%d entries) %x - %x", msg.Data.Len(), h1[0:4], h2[0:4]) - } + /* + switch msg.Type { + case ethwire.MsgPeersTy: + ret += fmt.Sprintf("(%d entries)", msg.Data.Len()) + case ethwire.MsgBlockTy: + b1, b2 := ethchain.NewBlockFromRlpValue(msg.Data.Get(0)), ethchain.NewBlockFromRlpValue(msg.Data.Get(msg.Data.Len()-1)) + ret += fmt.Sprintf("(%d entries) %x - %x", msg.Data.Len(), b1.Hash()[0:4], b2.Hash()[0:4]) + case ethwire.MsgBlockHashesTy: + h1, h2 := msg.Data.Get(0).Bytes(), msg.Data.Get(msg.Data.Len()-1).Bytes() + ret += fmt.Sprintf("(%d entries) %x - %x", msg.Data.Len(), h1, h2) + } + */ return } @@ -512,7 +514,7 @@ func (p *Peer) HandleInbound() { p.lastBlockReceived = time.Now() } - if foundCommonHash { + if foundCommonHash || msg.Data.Len() == 0 { p.FetchBlocks() } else { p.FetchHashes() |