move actor key to a const array
This commit is contained in:
parent
2c1cf42aa0
commit
970aa299a2
@ -32,6 +32,22 @@ const (
|
||||
VerifregKey = "verifiedregistry"
|
||||
)
|
||||
|
||||
func GetBuiltinActorsKeys() []string {
|
||||
return []string{
|
||||
AccountKey,
|
||||
CronKey,
|
||||
InitKey,
|
||||
MarketKey,
|
||||
MinerKey,
|
||||
MultisigKey,
|
||||
PaychKey,
|
||||
PowerKey,
|
||||
RewardKey,
|
||||
SystemKey,
|
||||
VerifregKey,
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
manifestMx sync.RWMutex
|
||||
)
|
||||
@ -85,19 +101,8 @@ func loadManifests(ctx context.Context, store cbor.IpldStore) error {
|
||||
|
||||
manifests[av] = mf
|
||||
|
||||
for _, name := range []string{
|
||||
AccountKey,
|
||||
CronKey,
|
||||
InitKey,
|
||||
MarketKey,
|
||||
MinerKey,
|
||||
MultisigKey,
|
||||
PaychKey,
|
||||
PowerKey,
|
||||
RewardKey,
|
||||
SystemKey,
|
||||
VerifregKey,
|
||||
} {
|
||||
var actorKeys = GetBuiltinActorsKeys()
|
||||
for _, name := range actorKeys {
|
||||
c, ok := mf.Get(name)
|
||||
if ok {
|
||||
actorMeta[c] = actorEntry{name: name, version: av}
|
||||
|
15
cli/state.go
15
cli/state.go
@ -1933,19 +1933,8 @@ var StateSysActorCIDsCmd = &cli.Command{
|
||||
tw := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0)
|
||||
_, _ = fmt.Fprintln(tw, "\nActor\tCID\t")
|
||||
|
||||
for _, name := range []string{
|
||||
actors.AccountKey,
|
||||
actors.CronKey,
|
||||
actors.InitKey,
|
||||
actors.MarketKey,
|
||||
actors.MinerKey,
|
||||
actors.MultisigKey,
|
||||
actors.PaychKey,
|
||||
actors.PowerKey,
|
||||
actors.RewardKey,
|
||||
actors.SystemKey,
|
||||
actors.VerifregKey,
|
||||
} {
|
||||
var actorKeys = actors.GetBuiltinActorsKeys()
|
||||
for _, name := range actorKeys {
|
||||
sysActorCID, ok := actors.GetActorCodeID(actorVersion, name)
|
||||
if !ok {
|
||||
return xerrors.Errorf("error getting actor %v code id for actor version %d", name,
|
||||
|
Loading…
Reference in New Issue
Block a user