aboutsummaryrefslogtreecommitdiffstats
path: root/xeth
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-19 07:02:55 +0800
committerobscuren <geffobscura@gmail.com>2014-12-19 07:02:55 +0800
commit22d29a6d52ade3ebcd4ecb341e3f5eafddb8e17b (patch)
treea64a8336516fd28de2c019e8c787c90950267331 /xeth
parent0dc566124aee24cf3f01b4e586bde7752da89824 (diff)
parenta7f4ade7114ee962110cb7c140e7ce7bd3f6664f (diff)
downloaddexon-22d29a6d52ade3ebcd4ecb341e3f5eafddb8e17b.tar
dexon-22d29a6d52ade3ebcd4ecb341e3f5eafddb8e17b.tar.gz
dexon-22d29a6d52ade3ebcd4ecb341e3f5eafddb8e17b.tar.bz2
dexon-22d29a6d52ade3ebcd4ecb341e3f5eafddb8e17b.tar.lz
dexon-22d29a6d52ade3ebcd4ecb341e3f5eafddb8e17b.tar.xz
dexon-22d29a6d52ade3ebcd4ecb341e3f5eafddb8e17b.tar.zst
dexon-22d29a6d52ade3ebcd4ecb341e3f5eafddb8e17b.zip
merge
Diffstat (limited to 'xeth')
-rw-r--r--xeth/hexface.go4
-rw-r--r--xeth/js_types.go14
-rw-r--r--xeth/pipe.go8
3 files changed, 13 insertions, 13 deletions
diff --git a/xeth/hexface.go b/xeth/hexface.go
index dfb0a9fd8..6c084f947 100644
--- a/xeth/hexface.go
+++ b/xeth/hexface.go
@@ -211,7 +211,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
@@ -224,7 +224,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(core.MessageCreatesContract(tx), 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 1d9faa190..987edce37 100644
--- a/xeth/js_types.go
+++ b/xeth/js_types.go
@@ -96,21 +96,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()
+ createsContract := core.MessageCreatesContract(tx)
var data string
- if tx.CreatesContract() {
- data = strings.Join(core.Disassemble(tx.Data), "\n")
+ if createsContract {
+ 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: 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
}