set up initial account state of new Secp accounts
This commit is contained in:
parent
72c6552b0b
commit
066b755b6a
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user