diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index 19e723bfa212a009f39b0165ce1ca475ac53c812..1a7a9eb18ed740a0ad37a8692b77fa17254d84a1 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -99,9 +99,6 @@ func importChain(ctx *cli.Context) error { if len(ctx.Args()) != 1 { utils.Fatalf("This command requires an argument.") } - if ctx.GlobalBool(utils.TestNetFlag.Name) { - state.StartingNonce = 1048576 // (2**20) - } stack := makeFullNode(ctx) chain, chainDb := utils.MakeChain(ctx, stack) defer chainDb.Close() diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 0eab77f7eb844bf1c8d7c85585cda6d303fe65f9..13d77179098a37e1f41374df36b0f7549052c9b0 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -34,7 +34,6 @@ import ( "github.com/ethereum/go-ethereum/console" "github.com/ethereum/go-ethereum/contracts/release" "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/internal/debug" "github.com/ethereum/go-ethereum/logger" @@ -237,10 +236,6 @@ func initGenesis(ctx *cli.Context) error { utils.Fatalf("must supply path to genesis JSON file") } - if ctx.GlobalBool(utils.TestNetFlag.Name) { - state.StartingNonce = 1048576 // (2**20) - } - stack := makeFullNode(ctx) chaindb := utils.MakeChainDatabase(ctx, stack) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index dd18fd78caf4288256d61f1794e21ed6fdce708a..fcdd0873702c18b1900f8cef568ce22c72c66bbc 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -38,7 +38,6 @@ import ( "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/les" - "github.com/ethereum/go-ethereum/light" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/metrics" @@ -754,8 +753,6 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) { ethConf.NetworkId = 2 } ethConf.Genesis = core.TestNetGenesisBlock() - state.StartingNonce = 1048576 // (2**20) - light.StartingNonce = 1048576 // (2**20) case ctx.GlobalBool(DevModeFlag.Name): ethConf.Genesis = core.OlympicGenesisBlock() diff --git a/core/genesis.go b/core/genesis.go index 8509f664ddc620b62353c00bfca7c948a0681971..44a83f236e461605d1b8bc4b1a2999c89a4e6c8b 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -43,7 +43,7 @@ func WriteGenesisBlock(chainDb ethdb.Database, reader io.Reader) (*types.Block, } var genesis struct { - ChainConfig *params.ChainConfig `json:"config"` + ChainConfig params.ChainConfig `json:"config"` Nonce string Timestamp string ParentHash string @@ -115,7 +115,7 @@ func WriteGenesisBlock(chainDb ethdb.Database, reader io.Reader) (*types.Block, if err := WriteHeadBlockHash(chainDb, block.Hash()); err != nil { return nil, err } - if err := WriteChainConfig(chainDb, block.Hash(), genesis.ChainConfig); err != nil { + if err := WriteChainConfig(chainDb, block.Hash(), &genesis.ChainConfig); err != nil { return nil, err } diff --git a/core/state/statedb.go b/core/state/statedb.go index 1c4af02958c817fa3846a09f1cd47a4df0c0915a..3742c178b9c2468c9c81370e39f2722ba4535970 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -34,10 +34,6 @@ import ( lru "github.com/hashicorp/golang-lru" ) -// The starting nonce determines the default nonce when new accounts are being -// created. -var StartingNonce uint64 - // Trie cache generation limit after which to evic trie nodes from memory. var MaxTrieCacheGen = uint16(120) @@ -239,7 +235,7 @@ func (self *StateDB) GetNonce(addr common.Address) uint64 { return stateObject.Nonce() } - return StartingNonce + return 0 } func (self *StateDB) GetCode(addr common.Address) []byte { @@ -423,7 +419,7 @@ func (self *StateDB) MarkStateObjectDirty(addr common.Address) { func (self *StateDB) createObject(addr common.Address) (newobj, prev *StateObject) { prev = self.GetStateObject(addr) newobj = newObject(self, addr, Account{}, self.MarkStateObjectDirty) - newobj.setNonce(StartingNonce) // sets the object to dirty + newobj.setNonce(0) // sets the object to dirty if prev == nil { if glog.V(logger.Core) { glog.Infof("(+) %x\n", addr) diff --git a/light/state.go b/light/state.go index 88f60efbbe37b467be8a6187cdd8dcdd0d4c8883..3c38f165b190a3987c148281c1fcc0246913b3e5 100644 --- a/light/state.go +++ b/light/state.go @@ -26,9 +26,6 @@ import ( "golang.org/x/net/context" ) -// StartingNonce determines the default nonce when new accounts are being created. -var StartingNonce uint64 - // LightState is a memory representation of a state. // This version is ODR capable, caching only the already accessed part of the // state, retrieving unknown parts on-demand from the ODR backend. Changes are @@ -238,7 +235,7 @@ func (self *LightState) newStateObject(addr common.Address) *StateObject { } stateObject := NewStateObject(addr, self.odr) - stateObject.SetNonce(StartingNonce) + stateObject.SetNonce(0) self.stateObjects[addr.Str()] = stateObject return stateObject diff --git a/mobile/geth.go b/mobile/geth.go index e209b667ca538c645fce3786a168466293dc2a95..738c0c548570ebc440423b77881fab4055619963 100644 --- a/mobile/geth.go +++ b/mobile/geth.go @@ -25,11 +25,9 @@ import ( "path/filepath" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/les" - "github.com/ethereum/go-ethereum/light" "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/p2p/nat" "github.com/ethereum/go-ethereum/params" @@ -63,10 +61,6 @@ type NodeConfig struct { // empty genesis state is equivalent to using the mainnet's state. EthereumGenesis string - // EthereumTestnetNonces specifies whether to use account nonces from the testnet - // range (2^20) or from the mainnet one (0). - EthereumTestnetNonces bool - // EthereumDatabaseCache is the system memory in MB to allocate for database caching. // A minimum of 16MB is always reserved. EthereumDatabaseCache int @@ -151,10 +145,6 @@ func NewNode(datadir string, config *NodeConfig) (*Node, error) { GpobaseStepUp: 100, GpobaseCorrectionFactor: 110, } - if config.EthereumTestnetNonces { - state.StartingNonce = 1048576 // (2**20) - light.StartingNonce = 1048576 // (2**20) - } if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { return les.New(ctx, ethConf) }); err != nil {