diff options
author | obscuren <geffobscura@gmail.com> | 2014-06-15 06:10:42 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-06-15 06:10:42 +0800 |
commit | 5871dbaf5a832a4fd34bdb22cf479d6b0b4da9fb (patch) | |
tree | 5caf4af617cd7e62d06a3118affe42f8d5dc7926 /ethpub | |
parent | b0e023e43248d09cb273d5b6025d28ee718151c0 (diff) | |
download | dexon-5871dbaf5a832a4fd34bdb22cf479d6b0b4da9fb.tar dexon-5871dbaf5a832a4fd34bdb22cf479d6b0b4da9fb.tar.gz dexon-5871dbaf5a832a4fd34bdb22cf479d6b0b4da9fb.tar.bz2 dexon-5871dbaf5a832a4fd34bdb22cf479d6b0b4da9fb.tar.lz dexon-5871dbaf5a832a4fd34bdb22cf479d6b0b4da9fb.tar.xz dexon-5871dbaf5a832a4fd34bdb22cf479d6b0b4da9fb.tar.zst dexon-5871dbaf5a832a4fd34bdb22cf479d6b0b4da9fb.zip |
Set contract addr for new transactions
Diffstat (limited to 'ethpub')
-rw-r--r-- | ethpub/types.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ethpub/types.go b/ethpub/types.go index 868fd2713..a76421007 100644 --- a/ethpub/types.go +++ b/ethpub/types.go @@ -111,11 +111,12 @@ func NewPTx(tx *ethchain.Transaction) *PTx { sender := hex.EncodeToString(tx.Sender()) createsContract := tx.CreatesContract() - data := strings.Join(ethchain.Disassemble(tx.Data), "\n") - - isContract := len(tx.Data) > 0 + data := string(tx.Data) + if tx.CreatesContract() { + data = strings.Join(ethchain.Disassemble(tx.Data), "\n") + } - return &PTx{ref: tx, Hash: hash, Value: ethutil.CurrencyToString(tx.Value), Address: receiver, Contract: isContract, Gas: tx.Gas.String(), GasPrice: tx.GasPrice.String(), Data: data, Sender: sender, CreatesContract: createsContract, RawData: hex.EncodeToString(tx.Data)} + return &PTx{ref: tx, Hash: hash, Value: ethutil.CurrencyToString(tx.Value), Address: receiver, Contract: tx.CreatesContract(), Gas: tx.Gas.String(), GasPrice: tx.GasPrice.String(), Data: data, Sender: sender, CreatesContract: createsContract, RawData: hex.EncodeToString(tx.Data)} } func (self *PTx) ToString() string { |