From 2da367a2bee84d74d1bb0ea1b42d4c22fae486dd Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Mon, 26 Jan 2015 10:57:23 -0800 Subject: [PATCH] fix unchecked slice index on tx.From() --- core/transaction_pool.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/transaction_pool.go b/core/transaction_pool.go index d3aec90502..193db45ed1 100644 --- a/core/transaction_pool.go +++ b/core/transaction_pool.go @@ -109,8 +109,13 @@ func (self *TxPool) Add(tx *types.Transaction) error { } else { to = "[NEW_CONTRACT]" } - - txplogger.Debugf("(t) %x => %s (%v) %x\n", tx.From()[:4], to, tx.Value, tx.Hash()) + var from string + if len(tx.From()) > 0 { + from = ethutil.Bytes2Hex(tx.From()[:4]) + } else { + from = "INVALID" + } + txplogger.Debugf("(t) %x => %s (%v) %x\n", from, to, tx.Value, tx.Hash()) // Notify the subscribers go self.eventMux.Post(TxPreEvent{tx})