fix: command: ./lotus-miner actor control list, if the owner is multisig.

This commit is contained in:
zl 2022-07-21 14:14:52 +08:00
parent 156fb17dad
commit 179efaf447

View File

@ -27,6 +27,7 @@ import (
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/adt"
builtin2 "github.com/filecoin-project/lotus/chain/actors/builtin"
lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner" lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
lcli "github.com/filecoin-project/lotus/cli" lcli "github.com/filecoin-project/lotus/cli"
@ -448,7 +449,7 @@ var actorControlList = &cli.Command{
} }
defer closer() defer closer()
api, acloser, err := lcli.GetFullNodeAPI(cctx) api, acloser, err := lcli.GetFullNodeAPIV1(cctx)
if err != nil { if err != nil {
return err return err
} }
@ -530,17 +531,26 @@ var actorControlList = &cli.Command{
} }
printKey := func(name string, a address.Address) { printKey := func(name string, a address.Address) {
b, err := api.WalletBalance(ctx, a) var actor *types.Actor
if err != nil { if actor, err = api.StateGetActor(ctx, a, types.EmptyTSK); err != nil {
fmt.Printf("%s\t%s: error getting balance: %s\n", name, a, err) fmt.Printf("%s\t%s: error getting actor: %s\n", name, a, err)
return return
} }
b := actor.Balance
k, err := api.StateAccountKey(ctx, a, types.EmptyTSK) var k address.Address
if err != nil { // 'a' maybe a 'robust', in that case, 'StateAccountKey' returns an error.
if builtin2.IsAccountActor(actor.Code) {
if k, err = api.StateAccountKey(ctx, a, types.EmptyTSK); err != nil {
fmt.Printf("%s\t%s: error getting account key: %s\n", name, a, err) fmt.Printf("%s\t%s: error getting account key: %s\n", name, a, err)
return return
} }
} else { // if builtin2.IsMultisigActor(actor.Code), Are there any other cases exist?
if k, err = api.StateLookupRobustAddress(ctx, a, types.EmptyTSK); err != nil {
fmt.Printf("%s\t%s: error getting robust address: %s\n", name, a, err)
return
}
}
kstr := k.String() kstr := k.String()
if !cctx.Bool("verbose") { if !cctx.Bool("verbose") {