aboutsummaryrefslogtreecommitdiffstats
path: root/peer.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2014-07-15 01:50:06 +0800
committerzelig <viktor.tron@gmail.com>2014-07-15 01:50:06 +0800
commit3d5db7288f134fef7e51b25776007705f6663654 (patch)
treeedda6e8fd23584327473058411df9cd2c53241f4 /peer.go
parentdc11b5c55e2888a7a3dac51fedc3864d112136ce (diff)
parent8845fb7eae3e51fd3e55c47c377bf1a9e0cfe2a9 (diff)
downloadgo-tangerine-3d5db7288f134fef7e51b25776007705f6663654.tar.gz
go-tangerine-3d5db7288f134fef7e51b25776007705f6663654.tar.zst
go-tangerine-3d5db7288f134fef7e51b25776007705f6663654.zip
merge upstream
Diffstat (limited to 'peer.go')
-rw-r--r--peer.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/peer.go b/peer.go
index a93d22d93..0a4f08af5 100644
--- a/peer.go
+++ b/peer.go
@@ -21,7 +21,7 @@ const (
// The size of the output buffer for writing messages
outputBufferSize = 50
// Current protocol version
- ProtocolVersion = 21
+ ProtocolVersion = 23
// Interval for ping/pong message
pingPongTimer = 2 * time.Second
)
@@ -252,7 +252,7 @@ func (p *Peer) writeMessage(msg *ethwire.Msg) {
}
}
- peerlogger.DebugDetailln("<=", msg.Type, msg.Data)
+ peerlogger.DebugDetailf("(%v) <= %v %v\n", p.conn.RemoteAddr(), msg.Type, msg.Data)
err := ethwire.WriteMessage(p.conn, msg)
if err != nil {
@@ -326,7 +326,7 @@ func (p *Peer) HandleInbound() {
peerlogger.Debugln(err)
}
for _, msg := range msgs {
- peerlogger.DebugDetailln("=>", msg.Type, msg.Data)
+ peerlogger.DebugDetailf("(%v) => %v %v\n", p.conn.RemoteAddr(), msg.Type, msg.Data)
switch msg.Type {
case ethwire.MsgHandshakeTy:
@@ -419,6 +419,16 @@ func (p *Peer) HandleInbound() {
if err != nil {
// If the parent is unknown try to catch up with this peer
if ethchain.IsParentErr(err) {
+ /*
+ b := ethchain.NewBlockFromRlpValue(msg.Data.Get(0))
+
+ peerlogger.Infof("Attempting to catch (%x). Parent known\n", b.Hash())
+ p.catchingUp = false
+
+ p.CatchupWithPeer(b.Hash())
+
+ peerlogger.Infoln(b)
+ */
peerlogger.Infoln("Attempting to catch. Parent known")
p.catchingUp = false
p.CatchupWithPeer(p.ethereum.BlockChain().CurrentBlock.Hash())
@@ -744,7 +754,7 @@ func (p *Peer) CatchupWithPeer(blockHash []byte) {
if !p.catchingUp {
// Make sure nobody else is catching up when you want to do this
p.catchingUp = true
- msg := ethwire.NewMessage(ethwire.MsgGetChainTy, []interface{}{blockHash, uint64(50)})
+ msg := ethwire.NewMessage(ethwire.MsgGetChainTy, []interface{}{blockHash, uint64(10)})
p.QueueMessage(msg)
peerlogger.DebugDetailf("Requesting blockchain %x... from peer %s\n", p.ethereum.BlockChain().CurrentBlock.Hash()[:4], p.conn.RemoteAddr())