check that accounts aren't overwritten

This commit is contained in:
Sami Mäkelä 2020-08-19 13:03:59 +03:00
parent e894f360a5
commit 99e71badbf
2 changed files with 4 additions and 2 deletions

View File

@ -288,7 +288,7 @@ func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template ge
return nil, nil, err 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 return nil, nil, err
} }
err = state.SetActor(remAccKey, &types.Actor{ err = state.SetActor(remAccKey, &types.Actor{

View File

@ -33,7 +33,6 @@ func SetupInitActor(bs bstore.Blockstore, netname string, initialActors []genesi
amap := adt.MakeEmptyMap(store) amap := adt.MakeEmptyMap(store)
keyToId := map[address.Address]address.Address{} keyToId := map[address.Address]address.Address{}
counter := int64(AccountStart) counter := int64(AccountStart)
for _, a := range initialActors { 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) return nil, nil, xerrors.Errorf("unmarshaling account meta: %w", err)
} }
for _, e := range ainfo.Signers { for _, e := range ainfo.Signers {
if _, ok := keyToId[e]; ok {
continue
}
fmt.Printf("init set %s t0%d\n", e, counter) fmt.Printf("init set %s t0%d\n", e, counter)
value := cbg.CborInt(counter) value := cbg.CborInt(counter)