aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-06-15 06:10:42 +0800
committerobscuren <geffobscura@gmail.com>2014-06-15 06:10:42 +0800
commit5871dbaf5a832a4fd34bdb22cf479d6b0b4da9fb (patch)
tree5caf4af617cd7e62d06a3118affe42f8d5dc7926
parentb0e023e43248d09cb273d5b6025d28ee718151c0 (diff)
downloadgo-tangerine-5871dbaf5a832a4fd34bdb22cf479d6b0b4da9fb.tar.gz
go-tangerine-5871dbaf5a832a4fd34bdb22cf479d6b0b4da9fb.tar.zst
go-tangerine-5871dbaf5a832a4fd34bdb22cf479d6b0b4da9fb.zip
Set contract addr for new transactions
-rw-r--r--ethchain/transaction.go2
-rw-r--r--ethpub/types.go9
2 files changed, 6 insertions, 5 deletions
diff --git a/ethchain/transaction.go b/ethchain/transaction.go
index 7aaab2fd1..3d52e4f73 100644
--- a/ethchain/transaction.go
+++ b/ethchain/transaction.go
@@ -25,7 +25,7 @@ type Transaction struct {
}
func NewContractCreationTx(value, gas, gasPrice *big.Int, script []byte) *Transaction {
- return &Transaction{Value: value, Gas: gas, GasPrice: gasPrice, Data: script, contractCreation: true}
+ return &Transaction{Recipient: ContractAddr, Value: value, Gas: gas, GasPrice: gasPrice, Data: script, contractCreation: true}
}
func NewTransactionMessage(to []byte, value, gas, gasPrice *big.Int, data []byte) *Transaction {
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 {