From 529fb7a7d76e4c98f825bfcb9f3c1fb40b1d0d1e Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 2 Jul 2015 11:19:10 +0200 Subject: core, xeth: core.AddressFromMessage removed => crypto.CreateAddress --- xeth/xeth.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'xeth/xeth.go') diff --git a/xeth/xeth.go b/xeth/xeth.go index 0dbedff43..2a1366fe1 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -802,7 +802,12 @@ func (self *XEth) PushTx(encodedTx string) (string, error) { } 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) return addr.Hex(), nil } else { @@ -969,7 +974,7 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS } if contractCreation { - addr := core.AddressFromMessage(tx) + addr := crypto.CreateAddress(from, nonce) glog.V(logger.Info).Infof("Tx(%x) created: %x\n", tx.Hash(), addr) return addr.Hex(), nil } else { -- cgit v1.2.3 From eb82ca4563cf80bef9b520673d3bd18283da3a1f Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 21 Jun 2015 20:33:51 +0100 Subject: rpc/js coinbase returns null if no etherbase set --- xeth/xeth.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'xeth/xeth.go') diff --git a/xeth/xeth.go b/xeth/xeth.go index 2a1366fe1..84d58a49f 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -477,7 +477,10 @@ func (self *XEth) IsListening() bool { } func (self *XEth) Coinbase() string { - eb, _ := self.backend.Etherbase() + eb, err := self.backend.Etherbase() + if err != nil { + return "0x0" + } return eb.Hex() } -- cgit v1.2.3 From 29e2fb38f8e80dfa077d139d8ff563169c644d74 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Fri, 3 Jul 2015 11:24:42 +0200 Subject: core, miner: miner header validation, transaction & receipt writing * Miners do now verify their own header, not their state. * Changed old putTx and putReceipts to be exported * Moved writing of transactions and receipts out of the block processer in to the chain manager. Closes #1386 * Miner post ChainHeadEvent & ChainEvent. Closes #1388 --- xeth/xeth.go | 1 + 1 file changed, 1 insertion(+) (limited to 'xeth/xeth.go') diff --git a/xeth/xeth.go b/xeth/xeth.go index 2a1366fe1..155ff3eea 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -980,6 +980,7 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS } else { glog.V(logger.Info).Infof("Tx(%x) to: %x\n", tx.Hash(), tx.To()) } + return tx.Hash().Hex(), nil } -- cgit v1.2.3 From 2feb23c1dacf1cc7ef664d92f28b63dd46502f21 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Sat, 4 Jul 2015 02:25:04 +0200 Subject: core, eth, miner, xeth: receipt storage fix * Added GetReceiptsFromBlock, GetReceipt, PutReceipts * Added ContractAddress to receipt. See #1042 --- xeth/xeth.go | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'xeth/xeth.go') diff --git a/xeth/xeth.go b/xeth/xeth.go index 155ff3eea..cbc8dbbde 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -364,22 +364,12 @@ func (self *XEth) CurrentBlock() *types.Block { return self.backend.ChainManager().CurrentBlock() } -func (self *XEth) GetBlockReceipts(bhash common.Hash) (receipts types.Receipts, err error) { +func (self *XEth) GetBlockReceipts(bhash common.Hash) types.Receipts { return self.backend.BlockProcessor().GetBlockReceipts(bhash) } -func (self *XEth) GetTxReceipt(txhash common.Hash) (receipt *types.Receipt, err error) { - _, bhash, _, txi := self.EthTransactionByHash(common.ToHex(txhash[:])) - var receipts types.Receipts - receipts, err = self.backend.BlockProcessor().GetBlockReceipts(bhash) - if err == nil { - if txi < uint64(len(receipts)) { - receipt = receipts[txi] - } else { - err = fmt.Errorf("Invalid tx index") - } - } - return +func (self *XEth) GetTxReceipt(txhash common.Hash) *types.Receipt { + return core.GetReceipt(self.backend.ExtraDb(), txhash) } func (self *XEth) GasLimit() *big.Int { -- cgit v1.2.3 From 481b221279be1673832f96e35e3fdc0f82e178bc Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sat, 4 Jul 2015 00:00:23 -0500 Subject: Decode full receipt storage --- xeth/xeth.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'xeth/xeth.go') diff --git a/xeth/xeth.go b/xeth/xeth.go index cbc8dbbde..1b7f06821 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -368,8 +368,8 @@ func (self *XEth) GetBlockReceipts(bhash common.Hash) types.Receipts { return self.backend.BlockProcessor().GetBlockReceipts(bhash) } -func (self *XEth) GetTxReceipt(txhash common.Hash) *types.Receipt { - return core.GetReceipt(self.backend.ExtraDb(), txhash) +func (self *XEth) GetTxReceipt(txhash common.Hash) *types.ReceiptForStorage { + return core.GetFullReceipt(self.backend.ExtraDb(), txhash) } func (self *XEth) GasLimit() *big.Int { -- cgit v1.2.3 From cd4cc309ae4ead756cbe58ad564b029e874d9832 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sat, 4 Jul 2015 11:28:30 -0500 Subject: Remove redundant function --- xeth/xeth.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'xeth/xeth.go') diff --git a/xeth/xeth.go b/xeth/xeth.go index 1b7f06821..cbc8dbbde 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -368,8 +368,8 @@ func (self *XEth) GetBlockReceipts(bhash common.Hash) types.Receipts { return self.backend.BlockProcessor().GetBlockReceipts(bhash) } -func (self *XEth) GetTxReceipt(txhash common.Hash) *types.ReceiptForStorage { - return core.GetFullReceipt(self.backend.ExtraDb(), txhash) +func (self *XEth) GetTxReceipt(txhash common.Hash) *types.Receipt { + return core.GetReceipt(self.backend.ExtraDb(), txhash) } func (self *XEth) GasLimit() *big.Int { -- cgit v1.2.3 From dd521ece3ff6163c891d2f945903533079413903 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Sun, 5 Jul 2015 12:25:44 -0500 Subject: Always return transaction hash --- xeth/xeth.go | 1 - 1 file changed, 1 deletion(-) (limited to 'xeth/xeth.go') diff --git a/xeth/xeth.go b/xeth/xeth.go index cbc8dbbde..1e87b738d 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -966,7 +966,6 @@ 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) - return addr.Hex(), nil } else { glog.V(logger.Info).Infof("Tx(%x) to: %x\n", tx.Hash(), tx.To()) } -- cgit v1.2.3 From ec9620fb2f375379d3404a834a3350089702648a Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 6 Jul 2015 10:43:06 +0200 Subject: core/types, xeth: separate tx hash and tx signature hash --- xeth/xeth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xeth/xeth.go') diff --git a/xeth/xeth.go b/xeth/xeth.go index 1cec82e5e..36276ecf2 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -978,7 +978,7 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS } func (self *XEth) sign(tx *types.Transaction, from common.Address, didUnlock bool) (*types.Transaction, error) { - hash := tx.Hash() + hash := tx.SigHash() sig, err := self.doSign(from, hash, didUnlock) if err != nil { return tx, err -- cgit v1.2.3 From 4f7fc7b23f50f3fba4e2fb6815738c4ec2c8fe0a Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Mon, 6 Jul 2015 13:43:02 +0200 Subject: rpc, xeth: fixed returned tx hash & receipt logs --- xeth/xeth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xeth/xeth.go') diff --git a/xeth/xeth.go b/xeth/xeth.go index 4bd18a2f6..f2295e6e1 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -973,7 +973,7 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS glog.V(logger.Info).Infof("Tx(%x) to: %x\n", tx.Hash(), tx.To()) } - return tx.Hash().Hex(), nil + return signed.Hash().Hex(), nil } func (self *XEth) sign(tx *types.Transaction, from common.Address, didUnlock bool) (*types.Transaction, error) { -- cgit v1.2.3 From 35cd355c14d9a5266a7d4b11127d25eb7f961494 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Tue, 7 Jul 2015 10:32:05 +0200 Subject: cmd,eth,rpc,tests: default coinbase --- xeth/xeth.go | 9 --------- 1 file changed, 9 deletions(-) (limited to 'xeth/xeth.go') diff --git a/xeth/xeth.go b/xeth/xeth.go index f2295e6e1..54b049a26 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -504,15 +504,6 @@ func (self *XEth) IsContract(address string) bool { return len(self.State().SafeGet(address).Code()) > 0 } -func (self *XEth) SecretToAddress(key string) string { - pair, err := crypto.NewKeyPairFromSec(common.FromHex(key)) - if err != nil { - return "" - } - - return common.ToHex(pair.Address()) -} - func (self *XEth) UninstallFilter(id int) bool { defer self.filterManager.UninstallFilter(id) -- cgit v1.2.3 From 1208ac83d5a93214f23bf3f9236e29869ee62407 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 5 Jul 2015 19:19:42 +0100 Subject: fix natspec test * registar url string retrieval chop leading zeros now * rewrite test using test mining * remove temporary applyTxs from xeth --- xeth/xeth.go | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'xeth/xeth.go') diff --git a/xeth/xeth.go b/xeth/xeth.go index f2295e6e1..a3923436a 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -203,34 +203,6 @@ func (self *XEth) AtStateNum(num int64) *XEth { return self.WithState(st) } -// applies queued transactions originating from address onto the latest state -// and creates a block -// only used in tests -// - could be removed in favour of mining on testdag (natspec e2e + networking) -// + filters -func (self *XEth) ApplyTestTxs(statedb *state.StateDB, address common.Address, txc uint64) (uint64, *XEth) { - chain := self.backend.ChainManager() - header := chain.CurrentBlock().Header() - coinbase := statedb.GetStateObject(address) - coinbase.SetGasLimit(big.NewInt(10000000)) - txs := self.backend.TxPool().GetQueuedTransactions() - - for i := 0; i < len(txs); i++ { - for _, tx := range txs { - if tx.Nonce() == txc { - _, _, err := core.ApplyMessage(core.NewEnv(statedb, self.backend.ChainManager(), tx, header), tx, coinbase) - if err != nil { - panic(err) - } - txc++ - } - } - } - - xeth := self.WithState(statedb) - return txc, xeth -} - func (self *XEth) WithState(statedb *state.StateDB) *XEth { xeth := &XEth{ backend: self.backend, -- cgit v1.2.3 From ea54283b304a1d308141d21e3ef75b7de0f4519d Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 7 Jul 2015 02:54:22 +0200 Subject: all: update license information --- xeth/xeth.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'xeth/xeth.go') diff --git a/xeth/xeth.go b/xeth/xeth.go index 8e3200ad5..75ff8539a 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -1,3 +1,19 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of go-ethereum. +// +// 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, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// 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 . + // eXtended ETHereum package xeth -- cgit v1.2.3 From bdae4fd573dbc163bab3d0e2d1a5c457892037cd Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 7 Jul 2015 05:08:16 +0200 Subject: all: add some godoc synopsis comments --- xeth/xeth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xeth/xeth.go') diff --git a/xeth/xeth.go b/xeth/xeth.go index 75ff8539a..d1085dc92 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with go-ethereum. If not, see . -// eXtended ETHereum +// Package xeth is the interface to all Ethereum functionality. package xeth import ( -- cgit v1.2.3