lotus/chain/gen/genesis/f00_system.go

32 lines
618 B
Go
Raw Normal View History

2020-02-14 21:38:18 +00:00
package genesis
import (
"context"
"github.com/filecoin-project/specs-actors/actors/builtin/system"
2020-02-14 21:38:18 +00:00
"github.com/filecoin-project/specs-actors/actors/builtin"
cbor "github.com/ipfs/go-ipld-cbor"
"github.com/filecoin-project/lotus/chain/types"
bstore "github.com/filecoin-project/lotus/lib/blockstore"
2020-02-14 21:38:18 +00:00
)
func SetupSystemActor(bs bstore.Blockstore) (*types.Actor, error) {
var st system.State
2020-02-14 21:38:18 +00:00
cst := cbor.NewCborStore(bs)
statecid, err := cst.Put(context.TODO(), &st)
2020-02-14 21:38:18 +00:00
if err != nil {
return nil, err
}
act := &types.Actor{
Code: builtin.SystemActorCodeID,
Head: statecid,
}
return act, nil
}