From 6b3f5fb82b0304f477a1c36b68b0d07232405aff Mon Sep 17 00:00:00 2001
From: Felix Lange <fjl@twurst.com>
Date: Wed, 29 Oct 2014 03:50:20 +0100
Subject: cmd/mist, ethchain, ethminer: split TxEvent (#165)

---
 ethchain/events.go           | 14 +++++++-------
 ethchain/state_manager.go    |  2 +-
 ethchain/transaction_pool.go |  9 ++-------
 3 files changed, 10 insertions(+), 15 deletions(-)

(limited to 'ethchain')

diff --git a/ethchain/events.go b/ethchain/events.go
index 05c21edfe..304e741b7 100644
--- a/ethchain/events.go
+++ b/ethchain/events.go
@@ -1,10 +1,10 @@
 package ethchain
 
-type TxEvent struct {
-	Type int // TxPre || TxPost
-	Tx   *Transaction
-}
+// TxPreEvent is posted when a transaction enters the transaction pool.
+type TxPreEvent struct{ Tx *Transaction }
 
-type NewBlockEvent struct {
-	Block *Block
-}
+// TxPostEvent is posted when a transaction has been processed.
+type TxPostEvent struct{ Tx *Transaction }
+
+// NewBlockEvent is posted when a block has been imported.
+type NewBlockEvent struct{ Block *Block }
diff --git a/ethchain/state_manager.go b/ethchain/state_manager.go
index dba3ff202..b759ae94e 100644
--- a/ethchain/state_manager.go
+++ b/ethchain/state_manager.go
@@ -190,7 +190,7 @@ done:
 		}
 
 		// Notify all subscribers
-		self.eth.EventMux().Post(TxEvent{TxPost, tx})
+		self.eth.EventMux().Post(TxPostEvent{tx})
 
 		receipts = append(receipts, receipt)
 		handled = append(handled, tx)
diff --git a/ethchain/transaction_pool.go b/ethchain/transaction_pool.go
index 7f8a5de42..7bd3e9ffd 100644
--- a/ethchain/transaction_pool.go
+++ b/ethchain/transaction_pool.go
@@ -14,17 +14,12 @@ import (
 
 var txplogger = ethlog.NewLogger("TXP")
 
-const (
-	txPoolQueueSize = 50
-)
+const txPoolQueueSize = 50
 
 type TxPoolHook chan *Transaction
 type TxMsgTy byte
 
 const (
-	TxPre = iota
-	TxPost
-
 	minGasPrice = 1000000
 )
 
@@ -169,7 +164,7 @@ out:
 				txplogger.Debugf("(t) %x => %x (%v) %x\n", tx.Sender()[:4], tmp, tx.Value, tx.Hash())
 
 				// Notify the subscribers
-				pool.Ethereum.EventMux().Post(TxEvent{TxPre, tx})
+				pool.Ethereum.EventMux().Post(TxPreEvent{tx})
 			}
 		case <-pool.quit:
 			break out
-- 
cgit v1.2.3