github.com/filecoin-project/specs-actors/v4@v4.0.2/actors/migration/nv12/miner.go (about)

     1  package nv12
     2  
     3  import (
     4  	"context"
     5  
     6  	miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner"
     7  	builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
     8  	miner4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/miner"
     9  	"github.com/ipfs/go-cid"
    10  	cbor "github.com/ipfs/go-ipld-cbor"
    11  )
    12  
    13  type minerMigrator struct{}
    14  
    15  func (m minerMigrator) migrateState(ctx context.Context, store cbor.IpldStore, in actorMigrationInput) (*actorMigrationResult, error) {
    16  	var inState miner3.State
    17  	if err := store.Get(ctx, in.head, &inState); err != nil {
    18  		return nil, err
    19  	}
    20  
    21  	outState := miner4.State{
    22  		// No change
    23  		Info:                      inState.Info,
    24  		PreCommitDeposits:         inState.PreCommitDeposits,
    25  		LockedFunds:               inState.LockedFunds,
    26  		VestingFunds:              inState.VestingFunds,
    27  		FeeDebt:                   inState.FeeDebt,
    28  		InitialPledge:             inState.InitialPledge,
    29  		PreCommittedSectors:       inState.PreCommittedSectors,
    30  		PreCommittedSectorsExpiry: inState.PreCommittedSectorsExpiry,
    31  		AllocatedSectors:          inState.AllocatedSectors,
    32  		Sectors:                   inState.Sectors,
    33  		ProvingPeriodStart:        inState.ProvingPeriodStart,
    34  		CurrentDeadline:           inState.CurrentDeadline,
    35  		Deadlines:                 inState.Deadlines,
    36  		EarlyTerminations:         inState.EarlyTerminations,
    37  		// Changed field
    38  		DeadlineCronActive: true,
    39  	}
    40  	newHead, err := store.Put(ctx, &outState)
    41  	return &actorMigrationResult{
    42  		newCodeCID: m.migratedCodeCID(),
    43  		newHead:    newHead,
    44  	}, err
    45  }
    46  
    47  func (m minerMigrator) migratedCodeCID() cid.Cid {
    48  	return builtin4.StorageMinerActorCodeID
    49  }