From 73c4ca3a6fcf948f4bc637f5c1b55277cf64c06f Mon Sep 17 00:00:00 2001
From: obscuren <geffobscura@gmail.com>
Date: Thu, 4 Dec 2014 15:31:48 +0100
Subject: Upped protocol version

---
 peer.go | 1 -
 1 file changed, 1 deletion(-)

(limited to 'peer.go')

diff --git a/peer.go b/peer.go
index bf84f6e35..3b39e45c7 100644
--- a/peer.go
+++ b/peer.go
@@ -756,7 +756,6 @@ func (p *Peer) handleHandshake(msg *wire.Msg) {
 
 	// Check correctness of p2p protocol version
 	if p2pVersion != P2PVersion {
-		fmt.Println(p)
 		peerlogger.Debugf("Invalid P2P version. Require protocol %d, received %d\n", P2PVersion, p2pVersion)
 		p.Stop()
 		return
-- 
cgit v1.2.3


From d80f8bda940a8ae8f6dab1502a46054c06cee5cc Mon Sep 17 00:00:00 2001
From: obscuren <geffobscura@gmail.com>
Date: Fri, 5 Dec 2014 12:32:47 +0100
Subject: Fixed issue in VM where LOG didn't pop anything of the stack

---
 peer.go | 39 ++++++++++++---------------------------
 1 file changed, 12 insertions(+), 27 deletions(-)

(limited to 'peer.go')

diff --git a/peer.go b/peer.go
index 3b39e45c7..46ac65247 100644
--- a/peer.go
+++ b/peer.go
@@ -24,7 +24,7 @@ const (
 	// The size of the output buffer for writing messages
 	outputBufferSize = 50
 	// Current protocol version
-	ProtocolVersion = 47
+	ProtocolVersion = 48
 	// Current P2P version
 	P2PVersion = 2
 	// Ethereum network version
@@ -129,9 +129,11 @@ type Peer struct {
 	statusKnown  bool
 
 	// Last received pong message
-	lastPong           int64
-	lastBlockReceived  time.Time
-	doneFetchingHashes bool
+	lastPong            int64
+	lastBlockReceived   time.Time
+	doneFetchingHashes  bool
+	lastHashAt          time.Time
+	lastHashRequestedAt time.Time
 
 	host             []byte
 	port             uint16
@@ -327,19 +329,16 @@ out:
 				}
 			}
 
+			switch msg.Type {
+			case wire.MsgGetBlockHashesTy:
+				p.lastHashRequestedAt = time.Now()
+			}
+
 			p.writeMessage(msg)
 			p.lastSend = time.Now()
 
 		// Ping timer
 		case <-pingTimer.C:
-			/*
-				timeSince := time.Since(time.Unix(p.lastPong, 0))
-				if !p.pingStartTime.IsZero() && p.lastPong != 0 && timeSince > (pingPongTimer+30*time.Second) {
-					peerlogger.Infof("Peer did not respond to latest pong fast enough, it took %s, disconnecting.\n", timeSince)
-					p.Stop()
-					return
-				}
-			*/
 			p.writeMessage(wire.NewMessage(wire.MsgPingTy, ""))
 			p.pingStartTime = time.Now()
 
@@ -462,18 +461,6 @@ func (p *Peer) HandleInbound() {
 			// TMP
 			if p.statusKnown {
 				switch msg.Type {
-				/*
-					case wire.MsgGetTxsTy:
-						// Get the current transactions of the pool
-						txs := p.ethereum.TxPool().CurrentTransactions()
-						// Get the RlpData values from the txs
-						txsInterface := make([]interface{}, len(txs))
-						for i, tx := range txs {
-							txsInterface[i] = tx.RlpData()
-						}
-						// Broadcast it back to the peer
-						p.QueueMessage(wire.NewMessage(wire.MsgTxTy, txsInterface))
-				*/
 
 				case wire.MsgGetBlockHashesTy:
 					if msg.Data.Len() < 2 {
@@ -508,6 +495,7 @@ func (p *Peer) HandleInbound() {
 					blockPool := p.ethereum.blockPool
 
 					foundCommonHash := false
+					p.lastHashAt = time.Now()
 
 					it := msg.Data.NewIterator()
 					for it.Next() {
@@ -524,9 +512,6 @@ func (p *Peer) HandleInbound() {
 					}
 
 					if !foundCommonHash {
-						//if !p.FetchHashes() {
-						//	p.doneFetchingHashes = true
-						//}
 						p.FetchHashes()
 					} else {
 						peerlogger.Infof("Found common hash (%x...)\n", p.lastReceivedHash[0:4])
-- 
cgit v1.2.3


From df5157c0b0be0feb5366070f7f5d0c6321513bf4 Mon Sep 17 00:00:00 2001
From: obscuren <geffobscura@gmail.com>
Date: Tue, 9 Dec 2014 20:28:36 +0100
Subject: PV49

---
 peer.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'peer.go')

diff --git a/peer.go b/peer.go
index 46ac65247..331e9de37 100644
--- a/peer.go
+++ b/peer.go
@@ -24,7 +24,7 @@ const (
 	// The size of the output buffer for writing messages
 	outputBufferSize = 50
 	// Current protocol version
-	ProtocolVersion = 48
+	ProtocolVersion = 49
 	// Current P2P version
 	P2PVersion = 2
 	// Ethereum network version
-- 
cgit v1.2.3


From 2d09e67713757e2a80eb614562c97f962af36cf7 Mon Sep 17 00:00:00 2001
From: obscuren <geffobscura@gmail.com>
Date: Thu, 18 Dec 2014 13:17:24 +0100
Subject: Updated to new methods

---
 peer.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'peer.go')

diff --git a/peer.go b/peer.go
index 331e9de37..13f0239d4 100644
--- a/peer.go
+++ b/peer.go
@@ -666,8 +666,8 @@ func (self *Peer) pushStatus() {
 	msg := wire.NewMessage(wire.MsgStatusTy, []interface{}{
 		uint32(ProtocolVersion),
 		uint32(NetVersion),
-		self.ethereum.ChainManager().TD,
-		self.ethereum.ChainManager().CurrentBlock.Hash(),
+		self.ethereum.ChainManager().Td(),
+		self.ethereum.ChainManager().CurrentBlock().Hash(),
 		self.ethereum.ChainManager().Genesis().Hash(),
 	})
 
-- 
cgit v1.2.3