From 16f417f5af16de8f1c2c140f8b249bd989200bd3 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 2 Jan 2015 22:19:58 +0100 Subject: Fixed bug where logging could crash client during tx adding --- core/transaction_pool.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'core') 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}) -- cgit