From afba798357372357a49068fa29b306b3e228e10f Mon Sep 17 00:00:00 2001 From: Gustav Simonsson Date: Mon, 13 Jul 2015 03:09:02 +0200 Subject: xeth: log signed tx hash --- xeth/xeth.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'xeth') diff --git a/xeth/xeth.go b/xeth/xeth.go index 2781c67c9..2d69dce6d 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -946,9 +946,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 -- cgit v1.2.3 From b1d0d3c0edb51a04e8c870fcad91c95091fe85e8 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 16 Jul 2015 11:04:53 +0200 Subject: xeth: removed unneeded mutex lock --- xeth/xeth.go | 3 --- 1 file changed, 3 deletions(-) (limited to 'xeth') diff --git a/xeth/xeth.go b/xeth/xeth.go index 2d69dce6d..19d9c0ad4 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -609,9 +609,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() -- cgit v1.2.3 From 3642441ca3a0afe94e581612ff99aef7f0e66a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 20 Jul 2015 14:02:02 +0300 Subject: xeth: fix #1485, data race in fiilter creation and event firing --- xeth/xeth.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'xeth') diff --git a/xeth/xeth.go b/xeth/xeth.go index 19d9c0ad4..34409a148 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -518,6 +518,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 +542,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 +559,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) { -- cgit v1.2.3 From 3f047be5aa93b6222506445414ca909dd59c7eeb Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 22 Jul 2015 18:48:40 +0200 Subject: all: update license headers to distiguish GPL/LGPL All code outside of cmd/ is licensed as LGPL. The headers now reflect this by calling the whole work "the go-ethereum library". --- xeth/frontend.go | 8 ++++---- xeth/state.go | 8 ++++---- xeth/types.go | 8 ++++---- xeth/whisper.go | 8 ++++---- xeth/whisper_filter.go | 8 ++++---- xeth/whisper_message.go | 8 ++++---- xeth/xeth.go | 8 ++++---- 7 files changed, 28 insertions(+), 28 deletions(-) (limited to 'xeth') diff --git a/xeth/frontend.go b/xeth/frontend.go index 967ccbaf5..315de18dc 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 // 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 . +// along with the go-ethereum library. If not, see . package xeth diff --git a/xeth/state.go b/xeth/state.go index 434c4aae9..689ddd2c1 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 // 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 . +// along with the go-ethereum library. If not, see . package xeth diff --git a/xeth/types.go b/xeth/types.go index f584b69ba..82da39960 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 // 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 . +// along with the go-ethereum library. If not, see . package xeth diff --git a/xeth/whisper.go b/xeth/whisper.go index 6deae4e5c..7c0c586e8 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 // 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 . +// along with the go-ethereum library. If not, see . // Contains the external API to the whisper sub-protocol. diff --git a/xeth/whisper_filter.go b/xeth/whisper_filter.go index b6c94ef83..92d020716 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 // 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 . +// along with the go-ethereum library. If not, see . // 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..593c7399b 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 // 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 . +// along with the go-ethereum library. If not, see . // Contains the external API representation of a whisper message. diff --git a/xeth/xeth.go b/xeth/xeth.go index 34409a148..3bc22a43d 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 // 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 . +// along with the go-ethereum library. If not, see . // Package xeth is the interface to all Ethereum functionality. package xeth -- cgit v1.2.3 From 8fc983097150325063a2e7558e0e14b2a8acca34 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Fri, 17 Jul 2015 15:43:16 +0200 Subject: cmd/core,xeth: removed unneeded states & added batch writes --- xeth/xeth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xeth') diff --git a/xeth/xeth.go b/xeth/xeth.go index 3bc22a43d..078a3fb8a 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -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() -- cgit v1.2.3 From bfbcfbe4a9dd9125391b56d6a13158cc5ec71c89 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 23 Jul 2015 18:35:11 +0200 Subject: all: fix license headers one more time I forgot to update one instance of "go-ethereum" in commit 3f047be5a. --- xeth/frontend.go | 2 +- xeth/state.go | 2 +- xeth/types.go | 2 +- xeth/whisper.go | 2 +- xeth/whisper_filter.go | 2 +- xeth/whisper_message.go | 2 +- xeth/xeth.go | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) (limited to 'xeth') diff --git a/xeth/frontend.go b/xeth/frontend.go index 315de18dc..e89282242 100644 --- a/xeth/frontend.go +++ b/xeth/frontend.go @@ -1,7 +1,7 @@ // Copyright 2015 The go-ethereum Authors // 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. diff --git a/xeth/state.go b/xeth/state.go index 689ddd2c1..16bfb523d 100644 --- a/xeth/state.go +++ b/xeth/state.go @@ -1,7 +1,7 @@ // Copyright 2015 The go-ethereum Authors // 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. diff --git a/xeth/types.go b/xeth/types.go index 82da39960..ad5101d61 100644 --- a/xeth/types.go +++ b/xeth/types.go @@ -1,7 +1,7 @@ // Copyright 2014 The go-ethereum Authors // 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. diff --git a/xeth/whisper.go b/xeth/whisper.go index 7c0c586e8..e7130978f 100644 --- a/xeth/whisper.go +++ b/xeth/whisper.go @@ -1,7 +1,7 @@ // Copyright 2015 The go-ethereum Authors // 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. diff --git a/xeth/whisper_filter.go b/xeth/whisper_filter.go index 92d020716..fdf5cebae 100644 --- a/xeth/whisper_filter.go +++ b/xeth/whisper_filter.go @@ -1,7 +1,7 @@ // Copyright 2015 The go-ethereum Authors // 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. diff --git a/xeth/whisper_message.go b/xeth/whisper_message.go index 593c7399b..b3014a697 100644 --- a/xeth/whisper_message.go +++ b/xeth/whisper_message.go @@ -1,7 +1,7 @@ // Copyright 2015 The go-ethereum Authors // 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. diff --git a/xeth/xeth.go b/xeth/xeth.go index 3bc22a43d..68d760ccb 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -1,7 +1,7 @@ // Copyright 2014 The go-ethereum Authors // 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. -- cgit v1.2.3 From 81e2124ea20503b70fac726868e3bbefd8c02d73 Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Tue, 28 Jul 2015 17:14:51 +0200 Subject: improved error detection and handling for NewTransactionFromBytes integrated review comments --- xeth/xeth.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'xeth') diff --git a/xeth/xeth.go b/xeth/xeth.go index 63826a334..5d54c1f7e 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -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)) } @@ -773,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 } -- cgit v1.2.3