diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-04-10 17:02:25 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-04-10 17:02:25 +0800 |
commit | 20fd60902b5c6bea7b7d9fb7b9031ce5925bffc4 (patch) | |
tree | b83dffa2ef4ca83da85cf5de6fb479efc10e22d4 | |
parent | 4de1e1609abb2e5be7e5cc5b8f206d305af8ce27 (diff) | |
parent | d1729acd2bb15401e6b9b6a41bd753b122771d3c (diff) | |
download | go-tangerine-20fd60902b5c6bea7b7d9fb7b9031ce5925bffc4.tar go-tangerine-20fd60902b5c6bea7b7d9fb7b9031ce5925bffc4.tar.gz go-tangerine-20fd60902b5c6bea7b7d9fb7b9031ce5925bffc4.tar.bz2 go-tangerine-20fd60902b5c6bea7b7d9fb7b9031ce5925bffc4.tar.lz go-tangerine-20fd60902b5c6bea7b7d9fb7b9031ce5925bffc4.tar.xz go-tangerine-20fd60902b5c6bea7b7d9fb7b9031ce5925bffc4.tar.zst go-tangerine-20fd60902b5c6bea7b7d9fb7b9031ce5925bffc4.zip |
Merge pull request #687 from karalabe/develop
xeth: fix #640, panic converting nil recipient to hex.
-rw-r--r-- | cmd/mist/gui.go | 12 | ||||
-rw-r--r-- | xeth/types.go | 7 |
2 files changed, 10 insertions, 9 deletions
diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index d37d6f81b..66614478c 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -238,13 +238,11 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { inout = "recv" } - var ( - ptx = xeth.NewTx(tx) - send = from.Hex() - rec = tx.To().Hex() - ) - ptx.Sender = send - ptx.Address = rec + ptx := xeth.NewTx(tx) + ptx.Sender = from.Hex() + if to := tx.To(); to != nil { + ptx.Address = to.Hex() + } if window == "post" { //gui.getObjectByName("transactionView").Call("addTx", ptx, inout) diff --git a/xeth/types.go b/xeth/types.go index 739092474..1be5e109c 100644 --- a/xeth/types.go +++ b/xeth/types.go @@ -140,8 +140,11 @@ type Transaction struct { func NewTx(tx *types.Transaction) *Transaction { hash := tx.Hash().Hex() - receiver := tx.To().Hex() - if len(receiver) == 0 { + + var receiver string + if to := tx.To(); to != nil { + receiver = to.Hex() + } else { receiver = core.AddressFromMessage(tx).Hex() } sender, _ := tx.From() |