-
Notifications
You must be signed in to change notification settings - Fork 0
/
cron.go
32 lines (26 loc) · 865 Bytes
/
cron.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package nv4
import (
"context"
"github.com/chenjianmei111/go-state-types/big"
cron0 "github.com/chenjianmei111/specs-actors/actors/builtin/cron"
cid "github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor"
cron2 "github.com/chenjianmei111/specs-actors/v2/actors/builtin/cron"
)
type cronMigrator struct {
}
func (m cronMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, head cid.Cid, _ MigrationInfo) (*StateMigrationResult, error) {
var inState cron0.State
if err := store.Get(ctx, head, &inState); err != nil {
return nil, err
}
outState := cron2.State{Entries: make([]cron2.Entry, len(inState.Entries))}
for i, e := range inState.Entries {
outState.Entries[i] = cron2.Entry(e) // Identical
}
newHead, err := store.Put(ctx, &outState)
return &StateMigrationResult{
NewHead: newHead,
Transfer: big.Zero(),
}, err
}