set up initial account state of new Secp accounts

This commit is contained in:
Aayush Rajasekaran 2020-03-23 05:43:30 -04:00 committed by Jeromy
parent 72c6552b0b
commit 066b755b6a

View File

@ -74,10 +74,18 @@ func NewBLSAccountActor(st *state.StateTree, addr address.Address) (*types.Actor
} }
func NewSecp256k1AccountActor(st *state.StateTree, addr address.Address) (*types.Actor, aerrors.ActorError) { func NewSecp256k1AccountActor(st *state.StateTree, addr address.Address) (*types.Actor, aerrors.ActorError) {
var acstate account.State
acstate.Address = addr
c, err := st.Store.Put(context.TODO(), &acstate)
if err != nil {
return nil, aerrors.Escalate(err, "serializing account actor state")
}
nact := &types.Actor{ nact := &types.Actor{
Code: builtin.AccountActorCodeID, Code: builtin.AccountActorCodeID,
Balance: types.NewInt(0), Balance: types.NewInt(0),
Head: EmptyObjectCid, Head: c,
} }
return nact, nil return nact, nil