From dc2b9fd458bbd4b41c83c5d6590d4d9f542458d0 Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Thu, 9 Apr 2015 20:06:27 +0200 Subject: [PATCH 1/3] bugfix as a result of PR 671 --- cmd/utils/customflags.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/utils/customflags.go b/cmd/utils/customflags.go index a623ae19c..78a6b8d22 100644 --- a/cmd/utils/customflags.go +++ b/cmd/utils/customflags.go @@ -18,11 +18,11 @@ type DirectoryString struct { Value string } -func (self DirectoryString) String() string { +func (self *DirectoryString) String() string { return self.Value } -func (self DirectoryString) Set(value string) error { +func (self *DirectoryString) Set(value string) error { self.Value = expandPath(value) return nil } @@ -72,9 +72,8 @@ func (self DirectoryFlag) Apply(set *flag.FlagSet) { } eachName(self.Name, func(name string) { - set.Var(self.Value, self.Name, "a: "+self.Usage) + set.Var(&self.Value, self.Name, self.Usage) }) - } func prefixFor(name string) (prefix string) { From b2b1241dd74137b8c17aa70b2225f76297ca00cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 10 Apr 2015 11:20:04 +0300 Subject: [PATCH 2/3] cmd/mist: fix #640, panic converting nil recipient to hex. Fetching the recipient address from a transaction was changed to return nil instead of a zero-address, but this code path was not updated, so whenever a contract was created, a nil panic occured. --- xeth/types.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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() From d1729acd2bb15401e6b9b6a41bd753b122771d3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 10 Apr 2015 11:43:08 +0300 Subject: [PATCH 3/3] cmd/mist: fix another nil recipient address panic. --- cmd/mist/gui.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 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)