aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorEthan Buchman <ethan@coinculture.info>2015-01-27 02:57:23 +0800
committerEthan Buchman <ethan@coinculture.info>2015-01-27 02:57:23 +0800
commit2da367a2bee84d74d1bb0ea1b42d4c22fae486dd (patch)
tree317c7f2826917493caafb55faa599001bdec4cb8 /core
parent48083608b513d97d9db10bbfdabb6e5f8830f08a (diff)
downloadgo-tangerine-2da367a2bee84d74d1bb0ea1b42d4c22fae486dd.tar
go-tangerine-2da367a2bee84d74d1bb0ea1b42d4c22fae486dd.tar.gz
go-tangerine-2da367a2bee84d74d1bb0ea1b42d4c22fae486dd.tar.bz2
go-tangerine-2da367a2bee84d74d1bb0ea1b42d4c22fae486dd.tar.lz
go-tangerine-2da367a2bee84d74d1bb0ea1b42d4c22fae486dd.tar.xz
go-tangerine-2da367a2bee84d74d1bb0ea1b42d4c22fae486dd.tar.zst
go-tangerine-2da367a2bee84d74d1bb0ea1b42d4c22fae486dd.zip
fix unchecked slice index on tx.From()
Diffstat (limited to 'core')
-rw-r--r--core/transaction_pool.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/transaction_pool.go b/core/transaction_pool.go
index d3aec9050..193db45ed 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})