forked from cerc-io/plugeth
Merge branch 'develop' of github.com:ethereum/go-ethereum into develop
This commit is contained in:
commit
9f6016e877
@ -7,7 +7,6 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core/state"
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
"github.com/ethereum/go-ethereum/core/vm"
|
"github.com/ethereum/go-ethereum/core/vm"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
|
||||||
"github.com/ethereum/go-ethereum/logger"
|
"github.com/ethereum/go-ethereum/logger"
|
||||||
"github.com/ethereum/go-ethereum/logger/glog"
|
"github.com/ethereum/go-ethereum/logger/glog"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
@ -56,11 +55,6 @@ type Message interface {
|
|||||||
Data() []byte
|
Data() []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddressFromMessage(msg Message) common.Address {
|
|
||||||
from, _ := msg.From()
|
|
||||||
return crypto.CreateAddress(from, msg.Nonce())
|
|
||||||
}
|
|
||||||
|
|
||||||
func MessageCreatesContract(msg Message) bool {
|
func MessageCreatesContract(msg Message) bool {
|
||||||
return msg.To() == nil
|
return msg.To() == nil
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,8 @@ func NewTx(tx *types.Transaction) *Transaction {
|
|||||||
if to := tx.To(); to != nil {
|
if to := tx.To(); to != nil {
|
||||||
receiver = to.Hex()
|
receiver = to.Hex()
|
||||||
} else {
|
} else {
|
||||||
receiver = core.AddressFromMessage(tx).Hex()
|
from, _ := tx.From()
|
||||||
|
receiver = crypto.CreateAddress(from, tx.Nonce()).Hex()
|
||||||
}
|
}
|
||||||
createsContract := core.MessageCreatesContract(tx)
|
createsContract := core.MessageCreatesContract(tx)
|
||||||
|
|
||||||
|
@ -802,7 +802,12 @@ func (self *XEth) PushTx(encodedTx string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if tx.To() == nil {
|
if tx.To() == nil {
|
||||||
addr := core.AddressFromMessage(tx)
|
from, err := tx.From()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
addr := crypto.CreateAddress(from, tx.Nonce())
|
||||||
glog.V(logger.Info).Infof("Tx(%x) created: %x\n", tx.Hash(), addr)
|
glog.V(logger.Info).Infof("Tx(%x) created: %x\n", tx.Hash(), addr)
|
||||||
return addr.Hex(), nil
|
return addr.Hex(), nil
|
||||||
} else {
|
} else {
|
||||||
@ -969,7 +974,7 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS
|
|||||||
}
|
}
|
||||||
|
|
||||||
if contractCreation {
|
if contractCreation {
|
||||||
addr := core.AddressFromMessage(tx)
|
addr := crypto.CreateAddress(from, nonce)
|
||||||
glog.V(logger.Info).Infof("Tx(%x) created: %x\n", tx.Hash(), addr)
|
glog.V(logger.Info).Infof("Tx(%x) created: %x\n", tx.Hash(), addr)
|
||||||
return addr.Hex(), nil
|
return addr.Hex(), nil
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user