aboutsummaryrefslogtreecommitdiffstats
path: root/core/mkalloc.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-10-20 16:49:46 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:23:39 +0800
commit856a327e813a05a2a7706efc82d813234fb2e349 (patch)
tree93ec783e925d4c6d5f01bc4fff07af4a6f35f2cc /core/mkalloc.go
parent6f50d557abae1def74f0e4509711da3d33dba43c (diff)
downloadgo-tangerine-856a327e813a05a2a7706efc82d813234fb2e349.tar.gz
go-tangerine-856a327e813a05a2a7706efc82d813234fb2e349.tar.zst
go-tangerine-856a327e813a05a2a7706efc82d813234fb2e349.zip
core: populate genesisAlloc in source code with DEXON genesis data
Diffstat (limited to 'core/mkalloc.go')
-rw-r--r--core/mkalloc.go21
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