diff options
Diffstat (limited to 'xeth')
-rw-r--r-- | xeth/types.go | 16 | ||||
-rw-r--r-- | xeth/xeth.go | 26 |
2 files changed, 29 insertions, 13 deletions
diff --git a/xeth/types.go b/xeth/types.go index 3f96f8f8b..739092474 100644 --- a/xeth/types.go +++ b/xeth/types.go @@ -77,15 +77,19 @@ func NewBlock(block *types.Block) *Block { } ptxs := make([]*Transaction, len(block.Transactions())) - for i, tx := range block.Transactions() { - ptxs[i] = NewTx(tx) - } + /* + for i, tx := range block.Transactions() { + ptxs[i] = NewTx(tx) + } + */ txlist := common.NewList(ptxs) puncles := make([]*Block, len(block.Uncles())) - for i, uncle := range block.Uncles() { - puncles[i] = NewBlock(types.NewBlockWithHeader(uncle)) - } + /* + for i, uncle := range block.Uncles() { + puncles[i] = NewBlock(types.NewBlockWithHeader(uncle)) + } + */ ulist := common.NewList(puncles) return &Block{ diff --git a/xeth/xeth.go b/xeth/xeth.go index b8d9ecb08..c1a2ec283 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -18,12 +18,12 @@ import ( "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/event/filter" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/rlp" ) var ( - pipelogger = logger.NewLogger("XETH") filterTickerTime = 5 * time.Minute defaultGasPrice = big.NewInt(10000000000000) //150000000000 defaultGas = big.NewInt(90000) //500000 @@ -218,7 +218,7 @@ func (self *XEth) EthTransactionByHash(hash string) (tx *types.Transaction, blha blnum = big.NewInt(int64(txExtra.BlockIndex)) txi = txExtra.Index } else { - pipelogger.Errorln(err) + glog.V(logger.Error).Infoln(err) } return @@ -393,7 +393,7 @@ func (self *XEth) NewFilterString(word string) int { self.logMut.Lock() defer self.logMut.Unlock() - self.logs[id].add(&state.StateLog{}) + self.logs[id].add(&state.Log{}) } case "latest": filter.BlockCallback = func(block *types.Block, logs state.Logs) { @@ -403,7 +403,7 @@ func (self *XEth) NewFilterString(word string) int { for _, log := range logs { self.logs[id].add(log) } - self.logs[id].add(&state.StateLog{}) + self.logs[id].add(&state.Log{}) } } @@ -572,8 +572,20 @@ func (self *XEth) PushTx(encodedTx string) (string, error) { func (self *XEth) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, dataStr string) (string, error) { statedb := self.State().State() //self.eth.ChainManager().TransState() + var from *state.StateObject + if len(fromStr) == 0 { + accounts, err := self.backend.AccountManager().Accounts() + if err != nil || len(accounts) == 0 { + from = statedb.GetOrNewStateObject(common.Address{}) + } else { + from = statedb.GetOrNewStateObject(common.BytesToAddress(accounts[0].Address)) + } + } else { + from = statedb.GetOrNewStateObject(common.HexToAddress(fromStr)) + } + msg := callmsg{ - from: statedb.GetOrNewStateObject(common.HexToAddress(fromStr)), + from: from, to: common.HexToAddress(toStr), gas: common.Big(gasStr), gasPrice: common.Big(gasPriceStr), @@ -664,7 +676,7 @@ func (self *XEth) Transact(fromStr, toStr, valueStr, gasStr, gasPriceStr, codeSt if contractCreation { addr := core.AddressFromMessage(tx) - pipelogger.Infof("Contract addr %x\n", addr) + glog.V(logger.Info).Infof("Contract addr %x\n", addr) return core.AddressFromMessage(tx).Hex(), nil } @@ -729,7 +741,7 @@ type logFilter struct { id int } -func (l *logFilter) add(logs ...state.Log) { +func (l *logFilter) add(logs ...*state.Log) { l.logs = append(l.logs, logs...) } |