Merge pull request #687 from karalabe/develop

xeth: fix #640, panic converting nil recipient to hex.
This commit is contained in:
Jeffrey Wilcke 2015-04-10 11:02:25 +02:00
commit 20fd60902b
2 changed files with 10 additions and 9 deletions

View File

@ -238,13 +238,11 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) {
inout = "recv" inout = "recv"
} }
var ( ptx := xeth.NewTx(tx)
ptx = xeth.NewTx(tx) ptx.Sender = from.Hex()
send = from.Hex() if to := tx.To(); to != nil {
rec = tx.To().Hex() ptx.Address = to.Hex()
) }
ptx.Sender = send
ptx.Address = rec
if window == "post" { if window == "post" {
//gui.getObjectByName("transactionView").Call("addTx", ptx, inout) //gui.getObjectByName("transactionView").Call("addTx", ptx, inout)

View File

@ -140,8 +140,11 @@ type Transaction struct {
func NewTx(tx *types.Transaction) *Transaction { func NewTx(tx *types.Transaction) *Transaction {
hash := tx.Hash().Hex() 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() receiver = core.AddressFromMessage(tx).Hex()
} }
sender, _ := tx.From() sender, _ := tx.From()