From d2ab322267e489f47b4b908d060411eb0554a029 Mon Sep 17 00:00:00 2001
From: obscuren <geffobscura@gmail.com>
Date: Wed, 30 Apr 2014 17:43:48 +0200
Subject: [PATCH] Removed debugging log

---
 ethchain/transaction_pool.go | 18 ++++++++++--------
 peer.go                      | 16 ++++------------
 2 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/ethchain/transaction_pool.go b/ethchain/transaction_pool.go
index fc807c580..8fbe676f5 100644
--- a/ethchain/transaction_pool.go
+++ b/ethchain/transaction_pool.go
@@ -91,14 +91,16 @@ func (pool *TxPool) addTransaction(tx *Transaction) {
 // Process transaction validates the Tx and processes funds from the
 // sender to the recipient.
 func (pool *TxPool) ProcessTransaction(tx *Transaction, block *Block, toContract bool) (err error) {
-	defer func() {
-		if r := recover(); r != nil {
-			log.Println(r)
-			err = fmt.Errorf("%v", r)
-		}
-	}()
+	/*
+		defer func() {
+			if r := recover(); r != nil {
+				log.Println(r)
+				err = fmt.Errorf("%v", r)
+			}
+		}()
+	*/
 	// Get the sender
-	sender := block.state.GetStateObject(tx.Sender())
+	sender := block.state.GetAccount(tx.Sender())
 
 	if sender.Nonce != tx.Nonce {
 		return fmt.Errorf("[TXPL] Invalid account nonce, state nonce is %d transaction nonce is %d instead", sender.Nonce, tx.Nonce)
@@ -112,7 +114,7 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, block *Block, toContract
 	}
 
 	// Get the receiver
-	receiver := block.state.GetStateObject(tx.Recipient)
+	receiver := block.state.GetAccount(tx.Recipient)
 	sender.Nonce += 1
 
 	// Send Tx to self
diff --git a/peer.go b/peer.go
index 28ccc324c..4f7005ac4 100644
--- a/peer.go
+++ b/peer.go
@@ -320,14 +320,11 @@ func (p *Peer) HandleInbound() {
 					// We requested blocks and now we need to make sure we have a common ancestor somewhere in these blocks so we can find
 					// common ground to start syncing from
 					lastBlock = ethchain.NewBlockFromRlpValue(msg.Data.Get(msg.Data.Len() - 1))
-					if p.ethereum.StateManager().BlockChain().HasBlock(lastBlock.Hash()) {
-						fmt.Println("[PEER] We found a common ancestor, let's continue.")
-					} else {
-
+					if !p.ethereum.StateManager().BlockChain().HasBlock(lastBlock.Hash()) {
 						// If we can't find a common ancenstor we need to request more blocks.
 						// FIXME: At one point this won't scale anymore since we are not asking for an offset
 						// we just keep increasing the amount of blocks.
-						fmt.Println("[PEER] No common ancestor found, requesting more blocks.")
+						//fmt.Println("[PEER] No common ancestor found, requesting more blocks.")
 						p.blocksRequested = p.blocksRequested * 2
 						p.catchingUp = false
 						p.SyncWithBlocks()
@@ -336,17 +333,13 @@ func (p *Peer) HandleInbound() {
 					for i := msg.Data.Len() - 1; i >= 0; i-- {
 						block = ethchain.NewBlockFromRlpValue(msg.Data.Get(i))
 						// Do we have this block on our chain? If so we can continue
-						if p.ethereum.StateManager().BlockChain().HasBlock(block.Hash()) {
-							ethutil.Config.Log.Debugf("[PEER] Block found, checking next one.\n")
-						} else {
+						if !p.ethereum.StateManager().BlockChain().HasBlock(block.Hash()) {
 							// We don't have this block, but we do have a block with the same prevHash, diversion time!
 							if p.ethereum.StateManager().BlockChain().HasBlockWithPrevHash(block.PrevHash) {
-								ethutil.Config.Log.Infof("[PEER] Local and foreign chain have diverted after %x, finding best chain!\n", block.PrevHash)
+								//ethutil.Config.Log.Infof("[PEER] Local and foreign chain have diverted after %x, finding best chain!\n", block.PrevHash)
 								if p.ethereum.StateManager().BlockChain().FindCanonicalChainFromMsg(msg, block.PrevHash) {
 									return
 								}
-							} else {
-								ethutil.Config.Log.Debugf("[PEER] Both local and foreign chain have same parent. Continue normally\n")
 							}
 						}
 					}
@@ -644,7 +637,6 @@ func (p *Peer) SyncWithBlocks() {
 		for _, block := range blocks {
 			hashes = append(hashes, block.Hash())
 		}
-		fmt.Printf("Requesting hashes from network: %x", hashes)
 
 		msgInfo := append(hashes, uint64(50))
 
-- 
GitLab