diff options
Diffstat (limited to 'xeth')
-rw-r--r-- | xeth/frontend.go | 10 | ||||
-rw-r--r-- | xeth/state.go | 10 | ||||
-rw-r--r-- | xeth/types.go | 10 | ||||
-rw-r--r-- | xeth/whisper.go | 10 | ||||
-rw-r--r-- | xeth/whisper_filter.go | 10 | ||||
-rw-r--r-- | xeth/whisper_message.go | 10 | ||||
-rw-r--r-- | xeth/xeth.go | 45 |
7 files changed, 61 insertions, 44 deletions
diff --git a/xeth/frontend.go b/xeth/frontend.go index 967ccbaf5..e89282242 100644 --- a/xeth/frontend.go +++ b/xeth/frontend.go @@ -1,18 +1,18 @@ // Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. +// This file is part of the go-ethereum library. // -// go-ethereum is free software: you can redistribute it and/or modify +// The go-ethereum library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// The go-ethereum library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. +// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. package xeth diff --git a/xeth/state.go b/xeth/state.go index 434c4aae9..16bfb523d 100644 --- a/xeth/state.go +++ b/xeth/state.go @@ -1,18 +1,18 @@ // Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. +// This file is part of the go-ethereum library. // -// go-ethereum is free software: you can redistribute it and/or modify +// The go-ethereum library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// The go-ethereum library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. +// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. package xeth diff --git a/xeth/types.go b/xeth/types.go index f584b69ba..ad5101d61 100644 --- a/xeth/types.go +++ b/xeth/types.go @@ -1,18 +1,18 @@ // Copyright 2014 The go-ethereum Authors -// This file is part of go-ethereum. +// This file is part of the go-ethereum library. // -// go-ethereum is free software: you can redistribute it and/or modify +// The go-ethereum library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// The go-ethereum library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. +// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. package xeth diff --git a/xeth/whisper.go b/xeth/whisper.go index 6deae4e5c..e7130978f 100644 --- a/xeth/whisper.go +++ b/xeth/whisper.go @@ -1,18 +1,18 @@ // Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. +// This file is part of the go-ethereum library. // -// go-ethereum is free software: you can redistribute it and/or modify +// The go-ethereum library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// The go-ethereum library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. +// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // Contains the external API to the whisper sub-protocol. diff --git a/xeth/whisper_filter.go b/xeth/whisper_filter.go index b6c94ef83..fdf5cebae 100644 --- a/xeth/whisper_filter.go +++ b/xeth/whisper_filter.go @@ -1,18 +1,18 @@ // Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. +// This file is part of the go-ethereum library. // -// go-ethereum is free software: you can redistribute it and/or modify +// The go-ethereum library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// The go-ethereum library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. +// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // Contains the external API side message filter for watching, pooling and polling // matched whisper messages, also serializing data access to avoid duplications. diff --git a/xeth/whisper_message.go b/xeth/whisper_message.go index 3c48561ec..b3014a697 100644 --- a/xeth/whisper_message.go +++ b/xeth/whisper_message.go @@ -1,18 +1,18 @@ // Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. +// This file is part of the go-ethereum library. // -// go-ethereum is free software: you can redistribute it and/or modify +// The go-ethereum library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// The go-ethereum library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. +// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // Contains the external API representation of a whisper message. diff --git a/xeth/xeth.go b/xeth/xeth.go index 2781c67c9..5d54c1f7e 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -1,18 +1,18 @@ // Copyright 2014 The go-ethereum Authors -// This file is part of go-ethereum. +// This file is part of the go-ethereum library. // -// go-ethereum is free software: you can redistribute it and/or modify +// The go-ethereum library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// The go-ethereum library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. +// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // Package xeth is the interface to all Ethereum functionality. package xeth @@ -123,7 +123,7 @@ func New(ethereum *eth.Ethereum, frontend Frontend) *XEth { if frontend == nil { xeth.frontend = dummyFrontend{} } - xeth.state = NewState(xeth, xeth.backend.ChainManager().TransState()) + xeth.state = NewState(xeth, xeth.backend.ChainManager().State()) go xeth.start() go xeth.filterManager.Start() @@ -310,7 +310,12 @@ func (self *XEth) EthTransactionByHash(hash string) (tx *types.Transaction, blha // some chain, this probably needs to be refactored for more expressiveness data, _ := self.backend.ExtraDb().Get(common.FromHex(hash)) if len(data) != 0 { - tx = types.NewTransactionFromBytes(data) + dtx := new(types.Transaction) + if err := rlp.DecodeBytes(data, dtx); err != nil { + glog.V(logger.Error).Infoln(err) + return + } + tx = dtx } else { // check pending transactions tx = self.backend.TxPool().GetTransaction(common.HexToHash(hash)) } @@ -518,6 +523,9 @@ func (self *XEth) UninstallFilter(id int) bool { } func (self *XEth) NewLogFilter(earliest, latest int64, skip, max int, address []string, topics [][]string) int { + self.logMu.Lock() + defer self.logMu.Unlock() + var id int filter := core.NewFilter(self.backend) filter.SetEarliestBlock(earliest) @@ -539,6 +547,9 @@ func (self *XEth) NewLogFilter(earliest, latest int64, skip, max int, address [] } func (self *XEth) NewTransactionFilter() int { + self.transactionMu.Lock() + defer self.transactionMu.Unlock() + var id int filter := core.NewFilter(self.backend) filter.TransactionCallback = func(tx *types.Transaction) { @@ -553,6 +564,9 @@ func (self *XEth) NewTransactionFilter() int { } func (self *XEth) NewBlockFilter() int { + self.blockMu.Lock() + defer self.blockMu.Unlock() + var id int filter := core.NewFilter(self.backend) filter.BlockCallback = func(block *types.Block, logs state.Logs) { @@ -609,9 +623,6 @@ func (self *XEth) TransactionFilterChanged(id int) []common.Hash { } func (self *XEth) Logs(id int) state.Logs { - self.logMu.Lock() - defer self.logMu.Unlock() - filter := self.filterManager.GetFilter(id) if filter != nil { return filter.Find() @@ -767,8 +778,14 @@ func (self *XEth) FromNumber(str string) string { } func (self *XEth) PushTx(encodedTx string) (string, error) { - tx := types.NewTransactionFromBytes(common.FromHex(encodedTx)) - err := self.backend.TxPool().Add(tx) + tx := new(types.Transaction) + err := rlp.DecodeBytes(common.FromHex(encodedTx), tx) + if err != nil { + glog.V(logger.Error).Infoln(err) + return "", err + } + + err = self.backend.TxPool().Add(tx) if err != nil { return "", err } @@ -946,9 +963,9 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS if contractCreation { addr := crypto.CreateAddress(from, nonce) - glog.V(logger.Info).Infof("Tx(%x) created: %x\n", tx.Hash(), addr) + glog.V(logger.Info).Infof("Tx(%s) created: %s\n", signed.Hash().Hex(), addr.Hex()) } else { - glog.V(logger.Info).Infof("Tx(%x) to: %x\n", tx.Hash(), tx.To()) + glog.V(logger.Info).Infof("Tx(%s) to: %s\n", signed.Hash().Hex(), tx.To().Hex()) } return signed.Hash().Hex(), nil |