aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/transaction_pool.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2014-06-23 19:54:10 +0800
committerzelig <viktor.tron@gmail.com>2014-06-23 19:54:10 +0800
commitb9e8a3e02493d5bbf23cfcab259e66f6ae166612 (patch)
tree63a13e2d4bfb3daf0a9b06b32b8ef8b849556781 /ethchain/transaction_pool.go
parent8e9cc3697944c3e568186a5c23ac729f6eb4a1f4 (diff)
downloadgo-tangerine-b9e8a3e02493d5bbf23cfcab259e66f6ae166612.tar
go-tangerine-b9e8a3e02493d5bbf23cfcab259e66f6ae166612.tar.gz
go-tangerine-b9e8a3e02493d5bbf23cfcab259e66f6ae166612.tar.bz2
go-tangerine-b9e8a3e02493d5bbf23cfcab259e66f6ae166612.tar.lz
go-tangerine-b9e8a3e02493d5bbf23cfcab259e66f6ae166612.tar.xz
go-tangerine-b9e8a3e02493d5bbf23cfcab259e66f6ae166612.tar.zst
go-tangerine-b9e8a3e02493d5bbf23cfcab259e66f6ae166612.zip
modified logging API
- package vars for tagged loggers - weed out spurious fmt.PrintX and log.PrintX logging - tried to second guess loglevel for some :)
Diffstat (limited to 'ethchain/transaction_pool.go')
-rw-r--r--ethchain/transaction_pool.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/ethchain/transaction_pool.go b/ethchain/transaction_pool.go
index 24836222a..44218ae28 100644
--- a/ethchain/transaction_pool.go
+++ b/ethchain/transaction_pool.go
@@ -3,15 +3,15 @@ package ethchain
import (
"bytes"
"container/list"
- "errors"
"fmt"
- "github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
- "log"
+ "github.com/ethereum/eth-go/ethlog"
"math/big"
"sync"
)
+var txplogger = ethlog.NewLogger("TXP")
+
const (
txPoolQueueSize = 50
)
@@ -97,7 +97,7 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, state *State, toContract
fmt.Printf("state root before update %x\n", state.Root())
defer func() {
if r := recover(); r != nil {
- ethutil.Config.Log.Infoln(r)
+ txplogger.Infoln(r)
err = fmt.Errorf("%v", r)
}
}()
@@ -156,7 +156,7 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, state *State, toContract
fmt.Printf("state root after receiver update %x\n", state.Root())
}
- ethutil.Config.Log.Infof("[TXPL] Processed Tx %x\n", tx.Hash())
+ txplogger.Infof("[TXPL] Processed Tx %x\n", tx.Hash())
return
}
@@ -168,7 +168,7 @@ func (pool *TxPool) ValidateTransaction(tx *Transaction) error {
block := pool.Ethereum.BlockChain().CurrentBlock
// Something has gone horribly wrong if this happens
if block == nil {
- return errors.New("[TXPL] No last block on the block chain")
+ return fmt.Errorf("[TXPL] No last block on the block chain")
}
if len(tx.Recipient) != 20 {
@@ -188,7 +188,7 @@ func (pool *TxPool) ValidateTransaction(tx *Transaction) error {
if tx.IsContract() {
if tx.GasPrice.Cmp(big.NewInt(minGasPrice)) < 0 {
- return fmt.Errorf("[TXPL] Gasprice to low, %s given should be at least %d.", tx.GasPrice, minGasPrice)
+ return fmt.Errorf("[TXPL] Gasprice too low, %s given should be at least %d.", tx.GasPrice, minGasPrice)
}
}
@@ -215,12 +215,12 @@ out:
// Validate the transaction
err := pool.ValidateTransaction(tx)
if err != nil {
- ethutil.Config.Log.Debugln("Validating Tx failed", err)
+ txplogger.Debugln("Validating Tx failed", err)
} else {
// Call blocking version.
pool.addTransaction(tx)
- ethutil.Config.Log.Debugf("(t) %x => %x (%v) %x\n", tx.Sender()[:4], tx.Recipient[:4], tx.Value, tx.Hash())
+ txplogger.Debugf("(t) %x => %x (%v) %x\n", tx.Sender()[:4], tx.Recipient[:4], tx.Value, tx.Hash())
// Notify the subscribers
pool.Ethereum.Reactor().Post("newTx:pre", tx)
@@ -282,5 +282,5 @@ func (pool *TxPool) Stop() {
pool.Flush()
- log.Println("[TXP] Stopped")
+ txplogger.Infoln("Stopped")
}