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.
33 lines
796 B
Go
33 lines
796 B
Go
package genesis
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
|
|
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
|
"github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
|
cbor "github.com/ipfs/go-ipld-cbor"
|
|
|
|
"github.com/filecoin-project/lotus/build"
|
|
"github.com/filecoin-project/lotus/chain/types"
|
|
bstore "github.com/filecoin-project/lotus/lib/blockstore"
|
|
)
|
|
|
|
func SetupRewardActor(bs bstore.Blockstore, qaPower big.Int) (*types.Actor, error) {
|
|
cst := cbor.NewCborStore(bs)
|
|
|
|
st := reward.ConstructState(qaPower)
|
|
|
|
hcid, err := cst.Put(context.TODO(), st)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &types.Actor{
|
|
Code: builtin.RewardActorCodeID,
|
|
Balance: types.BigInt{Int: build.InitialRewardBalance},
|
|
Head: hcid,
|
|
}, nil
|
|
}
|