diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-10-20 16:49:46 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2018-12-19 20:54:27 +0800 |
commit | b943825f9219bf26892f6f1ce2f107e8a5c47c74 (patch) | |
tree | 68401f6685e83443d8eaa9e242c3259513d0e720 /core/mkalloc.go | |
parent | 3efc6dda6a999279d177d620b9c71e71f05ab04a (diff) | |
download | dexon-b943825f9219bf26892f6f1ce2f107e8a5c47c74.tar dexon-b943825f9219bf26892f6f1ce2f107e8a5c47c74.tar.gz dexon-b943825f9219bf26892f6f1ce2f107e8a5c47c74.tar.bz2 dexon-b943825f9219bf26892f6f1ce2f107e8a5c47c74.tar.lz dexon-b943825f9219bf26892f6f1ce2f107e8a5c47c74.tar.xz dexon-b943825f9219bf26892f6f1ce2f107e8a5c47c74.tar.zst dexon-b943825f9219bf26892f6f1ce2f107e8a5c47c74.zip |
core: populate genesisAlloc in source code with DEXON genesis data
Diffstat (limited to 'core/mkalloc.go')
-rw-r--r-- | core/mkalloc.go | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/core/mkalloc.go b/core/mkalloc.go index a3ea567c2..cc246b5a8 100644 --- a/core/mkalloc.go +++ b/core/mkalloc.go @@ -38,7 +38,17 @@ import ( "github.com/dexon-foundation/dexon/rlp" ) -type allocItem struct{ Addr, Balance *big.Int } +type accountData struct { + Balance *big.Int + Staked *big.Int + Code []byte + PublicKey []byte +} + +type allocItem struct { + Addr *big.Int + Account accountData +} type allocList []allocItem @@ -49,10 +59,15 @@ func (a allocList) Swap(i, j int) { a[i], a[j] = a[j], a[i] } func makelist(g *core.Genesis) allocList { a := make(allocList, 0, len(g.Alloc)) for addr, account := range g.Alloc { - if len(account.Storage) > 0 || len(account.Code) > 0 || account.Nonce != 0 { + if len(account.Storage) > 0 || account.Nonce != 0 { panic(fmt.Sprintf("can't encode account %x", addr)) } - a = append(a, allocItem{addr.Big(), account.Balance}) + a = append(a, allocItem{addr.Big(), accountData{ + Code: account.Code, + Balance: account.Balance, + Staked: account.Staked, + PublicKey: account.PublicKey, + }}) } sort.Sort(a) return a |