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"
}
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)

View File

@ -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()