aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-03 05:19:58 +0800
committerobscuren <geffobscura@gmail.com>2015-01-03 05:19:58 +0800
commit16f417f5af16de8f1c2c140f8b249bd989200bd3 (patch)
treec0916e6cac3208a6a2ed889406a86ea3f71e433a /core
parent5c82fdc2434c302a2b65a4c7f25fe91b22cd43df (diff)
downloadgo-tangerine-16f417f5af16de8f1c2c140f8b249bd989200bd3.tar.gz
go-tangerine-16f417f5af16de8f1c2c140f8b249bd989200bd3.tar.zst
go-tangerine-16f417f5af16de8f1c2c140f8b249bd989200bd3.zip
Fixed bug where logging could crash client during tx adding
Diffstat (limited to 'core')
-rw-r--r--core/transaction_pool.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/transaction_pool.go b/core/transaction_pool.go
index 3349c9441..fa284e52d 100644
--- a/core/transaction_pool.go
+++ b/core/transaction_pool.go
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"gopkg.in/fatih/set.v0"
@@ -107,7 +108,14 @@ func (self *TxPool) Add(tx *types.Transaction) error {
self.addTransaction(tx)
- txplogger.Debugf("(t) %x => %x (%v) %x\n", tx.From()[:4], tx.To()[:4], tx.Value, tx.Hash())
+ var to string
+ if len(tx.To()) > 0 {
+ to = ethutil.Bytes2Hex(tx.To()[:4])
+ } else {
+ to = "[NEW_CONTRACT]"
+ }
+
+ txplogger.Debugf("(t) %x => %s (%v) %x\n", tx.From()[:4], to, tx.Value, tx.Hash())
// Notify the subscribers
go self.eventMux.Post(TxPreEvent{tx})