aboutsummaryrefslogtreecommitdiffstats
path: root/xeth
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-18 22:18:13 +0800
committerobscuren <geffobscura@gmail.com>2014-12-18 22:18:13 +0800
commitdb494170dc819b1eb0d267b6e1ab36c6cfb63569 (patch)
tree8e2b374519a0ae5e20a9db0c2a4a86bf3375329e /xeth
parent9e286e1c337319f47b2b04e9e1022ac05470a296 (diff)
downloadgo-tangerine-db494170dc819b1eb0d267b6e1ab36c6cfb63569.tar
go-tangerine-db494170dc819b1eb0d267b6e1ab36c6cfb63569.tar.gz
go-tangerine-db494170dc819b1eb0d267b6e1ab36c6cfb63569.tar.bz2
go-tangerine-db494170dc819b1eb0d267b6e1ab36c6cfb63569.tar.lz
go-tangerine-db494170dc819b1eb0d267b6e1ab36c6cfb63569.tar.xz
go-tangerine-db494170dc819b1eb0d267b6e1ab36c6cfb63569.tar.zst
go-tangerine-db494170dc819b1eb0d267b6e1ab36c6cfb63569.zip
Created generic message (easy for testing)
Diffstat (limited to 'xeth')
-rw-r--r--xeth/hexface.go4
-rw-r--r--xeth/js_types.go10
-rw-r--r--xeth/pipe.go8
3 files changed, 11 insertions, 11 deletions
diff --git a/xeth/hexface.go b/xeth/hexface.go
index 75ec5f43d..8fb42b4db 100644
--- a/xeth/hexface.go
+++ b/xeth/hexface.go
@@ -216,7 +216,7 @@ func (self *JSXEth) Transact(key, toStr, valueStr, gasStr, gasPriceStr, codeStr
return "", err
}
if types.IsContractAddr(to) {
- return ethutil.Bytes2Hex(tx.CreationAddress(nil)), nil
+ return ethutil.Bytes2Hex(core.AddressFromMessage(tx)), nil
}
return ethutil.Bytes2Hex(tx.Hash()), nil
@@ -229,7 +229,7 @@ func (self *JSXEth) PushTx(txStr string) (*JSReceipt, error) {
return nil, err
}
- return NewJSReciept(tx.CreatesContract(), tx.CreationAddress(self.World().State()), tx.Hash(), tx.Sender()), nil
+ return NewJSReciept(tx.CreatesContract(), core.AddressFromMessage(tx), tx.Hash(), tx.From()), nil
}
func (self *JSXEth) CompileMutan(code string) string {
diff --git a/xeth/js_types.go b/xeth/js_types.go
index da26439cf..2d6ee91bc 100644
--- a/xeth/js_types.go
+++ b/xeth/js_types.go
@@ -97,21 +97,21 @@ type JSTransaction struct {
func NewJSTx(tx *types.Transaction, state *state.StateDB) *JSTransaction {
hash := ethutil.Bytes2Hex(tx.Hash())
- receiver := ethutil.Bytes2Hex(tx.Recipient)
+ receiver := ethutil.Bytes2Hex(tx.To())
if receiver == "0000000000000000000000000000000000000000" {
- receiver = ethutil.Bytes2Hex(tx.CreationAddress(state))
+ receiver = ethutil.Bytes2Hex(core.AddressFromMessage(tx))
}
sender := ethutil.Bytes2Hex(tx.Sender())
createsContract := tx.CreatesContract()
var data string
if tx.CreatesContract() {
- data = strings.Join(core.Disassemble(tx.Data), "\n")
+ data = strings.Join(core.Disassemble(tx.Data()), "\n")
} else {
- data = ethutil.Bytes2Hex(tx.Data)
+ data = ethutil.Bytes2Hex(tx.Data())
}
- return &JSTransaction{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: ethutil.Bytes2Hex(tx.Data)}
+ return &JSTransaction{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: ethutil.Bytes2Hex(tx.Data())}
}
func (self *JSTransaction) ToString() string {
diff --git a/xeth/pipe.go b/xeth/pipe.go
index 1e4d0ec60..06820cc86 100644
--- a/xeth/pipe.go
+++ b/xeth/pipe.go
@@ -134,7 +134,7 @@ func (self *XEth) Transact(key *crypto.KeyPair, to []byte, value, gas, price *et
state := self.chainManager.TransState()
nonce := state.GetNonce(key.Address())
- tx.Nonce = nonce
+ tx.SetNonce(nonce)
tx.Sign(key.PrivateKey)
// Do some pre processing for our "pre" events and hooks
@@ -150,7 +150,7 @@ func (self *XEth) Transact(key *crypto.KeyPair, to []byte, value, gas, price *et
state.SetNonce(key.Address(), nonce+1)
if contractCreation {
- addr := tx.CreationAddress(self.World().State())
+ addr := core.AddressFromMessage(tx)
pipelogger.Infof("Contract addr %x\n", addr)
}
@@ -163,8 +163,8 @@ func (self *XEth) PushTx(tx *types.Transaction) ([]byte, error) {
return nil, err
}
- if tx.Recipient == nil {
- addr := tx.CreationAddress(self.World().State())
+ if tx.To() == nil {
+ addr := core.AddressFromMessage(tx)
pipelogger.Infof("Contract addr %x\n", addr)
return addr, nil
}