From 4c490db6afeb5a48d3e8d1d65ea8ddc9811d0a6d Mon Sep 17 00:00:00 2001 From: Gustav Simonsson Date: Tue, 30 Jun 2015 09:13:16 +0200 Subject: Use uint64 for block header timestamp --- xeth/types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xeth') diff --git a/xeth/types.go b/xeth/types.go index ed64dc45e..1d6a0c5ca 100644 --- a/xeth/types.go +++ b/xeth/types.go @@ -60,7 +60,7 @@ type Block struct { Hash string `json:"hash"` Transactions *common.List `json:"transactions"` Uncles *common.List `json:"uncles"` - Time int64 `json:"time"` + Time uint64 `json:"time"` Coinbase string `json:"coinbase"` Name string `json:"name"` GasLimit string `json:"gasLimit"` -- cgit v1.2.3 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/types.go | 3 ++- xeth/xeth.go | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'xeth') diff --git a/xeth/types.go b/xeth/types.go index 1d6a0c5ca..cc06a8dcd 100644 --- a/xeth/types.go +++ b/xeth/types.go @@ -149,7 +149,8 @@ func NewTx(tx *types.Transaction) *Transaction { if to := tx.To(); to != nil { receiver = to.Hex() } else { - receiver = core.AddressFromMessage(tx).Hex() + from, _ := tx.From() + receiver = crypto.CreateAddress(from, tx.Nonce()).Hex() } createsContract := core.MessageCreatesContract(tx) 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') 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') 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') 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') 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') 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') 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') 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') 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/types.go | 10 ---------- xeth/xeth.go | 9 --------- 2 files changed, 19 deletions(-) (limited to 'xeth') diff --git a/xeth/types.go b/xeth/types.go index cc06a8dcd..35ed2d308 100644 --- a/xeth/types.go +++ b/xeth/types.go @@ -168,16 +168,6 @@ func (self *Transaction) ToString() string { return self.ref.String() } -type Key struct { - Address string `json:"address"` - PrivateKey string `json:"privateKey"` - PublicKey string `json:"publicKey"` -} - -func NewKey(key *crypto.KeyPair) *Key { - return &Key{common.ToHex(key.Address()), common.ToHex(key.PrivateKey), common.ToHex(key.PublicKey)} -} - type PReceipt struct { CreatedContract bool `json:"createdContract"` Address string `json:"address"` 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') 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/frontend.go | 16 ++++++++++++++++ xeth/state.go | 16 ++++++++++++++++ xeth/types.go | 16 ++++++++++++++++ xeth/whisper.go | 16 ++++++++++++++++ xeth/whisper_filter.go | 16 ++++++++++++++++ xeth/whisper_message.go | 16 ++++++++++++++++ xeth/xeth.go | 16 ++++++++++++++++ 7 files changed, 112 insertions(+) (limited to 'xeth') diff --git a/xeth/frontend.go b/xeth/frontend.go index fe1d57c50..967ccbaf5 100644 --- a/xeth/frontend.go +++ b/xeth/frontend.go @@ -1,3 +1,19 @@ +// Copyright 2015 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 . + package xeth // Frontend should be implemented by users of XEth. Its methods are diff --git a/xeth/state.go b/xeth/state.go index 669cf91e6..434c4aae9 100644 --- a/xeth/state.go +++ b/xeth/state.go @@ -1,3 +1,19 @@ +// Copyright 2015 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 . + package xeth import ( diff --git a/xeth/types.go b/xeth/types.go index 35ed2d308..f584b69ba 100644 --- a/xeth/types.go +++ b/xeth/types.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 . + package xeth import ( diff --git a/xeth/whisper.go b/xeth/whisper.go index edb62c748..6deae4e5c 100644 --- a/xeth/whisper.go +++ b/xeth/whisper.go @@ -1,3 +1,19 @@ +// Copyright 2015 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 . + // Contains the external API to the whisper sub-protocol. package xeth diff --git a/xeth/whisper_filter.go b/xeth/whisper_filter.go index 52e70e041..b6c94ef83 100644 --- a/xeth/whisper_filter.go +++ b/xeth/whisper_filter.go @@ -1,3 +1,19 @@ +// Copyright 2015 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 . + // 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 c8195cec1..3c48561ec 100644 --- a/xeth/whisper_message.go +++ b/xeth/whisper_message.go @@ -1,3 +1,19 @@ +// Copyright 2015 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 . + // Contains the external API representation of a whisper message. package xeth 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') 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