b7a4dbb07f
And use the new CidBuilder from the spec actors. This patch does not switch over to inline CIDs by default, but paves the way.
32 lines
618 B
Go
32 lines
618 B
Go
package genesis
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/filecoin-project/specs-actors/actors/builtin/system"
|
|
|
|
"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"
|
|
)
|
|
|
|
func SetupSystemActor(bs bstore.Blockstore) (*types.Actor, error) {
|
|
var st system.State
|
|
|
|
cst := cbor.NewCborStore(bs)
|
|
|
|
statecid, err := cst.Put(context.TODO(), &st)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
act := &types.Actor{
|
|
Code: builtin.SystemActorCodeID,
|
|
Head: statecid,
|
|
}
|
|
|
|
return act, nil
|
|
}
|