From 99e71badbf07a3560a80c7247e612d7f297eb263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20M=C3=A4kel=C3=A4?= Date: Wed, 19 Aug 2020 13:03:59 +0300 Subject: [PATCH] check that accounts aren't overwritten --- chain/gen/genesis/genesis.go | 2 +- chain/gen/genesis/t01_init.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/chain/gen/genesis/genesis.go b/chain/gen/genesis/genesis.go index 651b909b4..3ff38218c 100644 --- a/chain/gen/genesis/genesis.go +++ b/chain/gen/genesis/genesis.go @@ -288,7 +288,7 @@ func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template ge return nil, nil, err } - if err := createAccount(ctx, bs, cst, state, remAccKey, template.RemainderAccount); err != nil { + if err := createAccount(ctx, bs, cst, state, remAccKey, template.RemainderAccount, keyIDs); err != nil { return nil, nil, err } err = state.SetActor(remAccKey, &types.Actor{ diff --git a/chain/gen/genesis/t01_init.go b/chain/gen/genesis/t01_init.go index b15ada470..095f275fd 100644 --- a/chain/gen/genesis/t01_init.go +++ b/chain/gen/genesis/t01_init.go @@ -33,7 +33,6 @@ func SetupInitActor(bs bstore.Blockstore, netname string, initialActors []genesi amap := adt.MakeEmptyMap(store) keyToId := map[address.Address]address.Address{} - counter := int64(AccountStart) for _, a := range initialActors { @@ -105,6 +104,9 @@ func SetupInitActor(bs bstore.Blockstore, netname string, initialActors []genesi return nil, nil, xerrors.Errorf("unmarshaling account meta: %w", err) } for _, e := range ainfo.Signers { + if _, ok := keyToId[e]; ok { + continue + } fmt.Printf("init set %s t0%d\n", e, counter) value := cbg.CborInt(counter)