aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-10-05 19:01:34 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-10-09 04:01:39 +0800
commit1de796f10134bb4aa245591e0d8802e320892efb (patch)
treedff14c87d5c29b779ab1e4543acd66489ea55bb2 /core
parent44fd3951410fb5923d7e578ac97942a7ea791e96 (diff)
downloaddexon-1de796f10134bb4aa245591e0d8802e320892efb.tar.gz
dexon-1de796f10134bb4aa245591e0d8802e320892efb.tar.zst
dexon-1de796f10134bb4aa245591e0d8802e320892efb.zip
cmd, core, eth: added official testnet
Diffstat (limited to 'core')
-rw-r--r--core/genesis.go21
-rw-r--r--core/state/statedb.go5
2 files changed, 26 insertions, 0 deletions
diff --git a/core/genesis.go b/core/genesis.go
index bf97da2e2..bfa8696af 100644
--- a/core/genesis.go
+++ b/core/genesis.go
@@ -156,6 +156,27 @@ func WriteGenesisBlockForTesting(db ethdb.Database, accounts ...GenesisAccount)
func WriteTestNetGenesisBlock(chainDb ethdb.Database, nonce uint64) (*types.Block, error) {
testGenesis := fmt.Sprintf(`{
+ "nonce": "0x%x",
+ "difficulty": "0x20000",
+ "mixhash": "0x00000000000000000000000000000000000000647572616c65787365646c6578",
+ "coinbase": "0x0000000000000000000000000000000000000000",
+ "timestamp": "0x00",
+ "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
+ "extraData": "0x",
+ "gasLimit": "0x2FEFD8",
+ "alloc": {
+ "0000000000000000000000000000000000000001": { "balance": "1" },
+ "0000000000000000000000000000000000000002": { "balance": "1" },
+ "0000000000000000000000000000000000000003": { "balance": "1" },
+ "0000000000000000000000000000000000000004": { "balance": "1" },
+ "102e61f5d8f9bc71d0ad4a084df4e65e05ce0e1c": { "balance": "1606938044258990275541962092341162602522202993782792835301376" }
+ }
+}`, types.EncodeNonce(nonce))
+ return WriteGenesisBlock(chainDb, strings.NewReader(testGenesis))
+}
+
+func WriteOlympicGenesisBlock(chainDb ethdb.Database, nonce uint64) (*types.Block, error) {
+ testGenesis := fmt.Sprintf(`{
"nonce":"0x%x",
"gasLimit":"0x%x",
"difficulty":"0x%x",
diff --git a/core/state/statedb.go b/core/state/statedb.go
index 499ea5f52..ad673aecb 100644
--- a/core/state/statedb.go
+++ b/core/state/statedb.go
@@ -28,6 +28,10 @@ import (
"github.com/ethereum/go-ethereum/trie"
)
+// The starting nonce determines the default nonce when new accounts are being
+// created.
+var StartingNonce uint64
+
// StateDBs within the ethereum protocol are used to store anything
// within the merkle trie. StateDBs take care of caching and storing
// nested states. It's the general query interface to retrieve:
@@ -263,6 +267,7 @@ func (self *StateDB) newStateObject(addr common.Address) *StateObject {
}
stateObject := NewStateObject(addr, self.db)
+ stateObject.SetNonce(StartingNonce)
self.stateObjects[addr.Str()] = stateObject
return stateObject