diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-09-22 02:45:59 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-09-22 02:45:59 +0800 |
commit | 7bf8e949e7e4da47d8fd094ee692ec6b30b6a046 (patch) | |
tree | a94fa5918507ae17f78f650e2f4caaa88a9ba08c /core/genesis.go | |
parent | be76a68aeacccce8ad63270a98beb34db37f0d88 (diff) | |
parent | eaa4473dbd4ad404b85f8f0f63b0418a782351b4 (diff) | |
download | dexon-7bf8e949e7e4da47d8fd094ee692ec6b30b6a046.tar dexon-7bf8e949e7e4da47d8fd094ee692ec6b30b6a046.tar.gz dexon-7bf8e949e7e4da47d8fd094ee692ec6b30b6a046.tar.bz2 dexon-7bf8e949e7e4da47d8fd094ee692ec6b30b6a046.tar.lz dexon-7bf8e949e7e4da47d8fd094ee692ec6b30b6a046.tar.xz dexon-7bf8e949e7e4da47d8fd094ee692ec6b30b6a046.tar.zst dexon-7bf8e949e7e4da47d8fd094ee692ec6b30b6a046.zip |
Merge pull request #1669 from obscuren/tx-pool-auto-resend
core, xeth: chain reorg move missing transactions to transaction pool
Diffstat (limited to 'core/genesis.go')
-rw-r--r-- | core/genesis.go | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/core/genesis.go b/core/genesis.go index 727e2c75f..b2346da65 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -125,15 +125,27 @@ func GenesisBlockForTesting(db ethdb.Database, addr common.Address, balance *big return block } -func WriteGenesisBlockForTesting(db ethdb.Database, addr common.Address, balance *big.Int) *types.Block { +type GenesisAccount struct { + Address common.Address + Balance *big.Int +} + +func WriteGenesisBlockForTesting(db ethdb.Database, accounts ...GenesisAccount) *types.Block { + accountJson := "{" + for i, account := range accounts { + if i != 0 { + accountJson += "," + } + accountJson += fmt.Sprintf(`"0x%x":{"balance":"0x%x"}`, account.Address, account.Balance.Bytes()) + } + accountJson += "}" + testGenesis := fmt.Sprintf(`{ "nonce":"0x%x", "gasLimit":"0x%x", "difficulty":"0x%x", - "alloc": { - "0x%x":{"balance":"0x%x"} - } -}`, types.EncodeNonce(0), params.GenesisGasLimit.Bytes(), params.GenesisDifficulty.Bytes(), addr, balance.Bytes()) + "alloc": %s +}`, types.EncodeNonce(0), params.GenesisGasLimit.Bytes(), params.GenesisDifficulty.Bytes(), accountJson) block, _ := WriteGenesisBlock(db, strings.NewReader(testGenesis)) return block } |