Wrap error in wallet sign if msig

Wrap error when a msig is trying to sign a msg, explaining that msigs needs to propose & approve.
This commit is contained in:
Phi 2023-09-19 10:57:35 +02:00
parent 8aaa8de975
commit 7e40f8636b

View File

@ -22,6 +22,7 @@ import (
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/lib/tablewriter"
)
@ -459,7 +460,12 @@ var walletSign = &cli.Command{
sig, err := api.WalletSign(ctx, addr, msg)
if err != nil {
return err
// Check if the address is a multisig address
act, actErr := api.StateGetActor(ctx, addr, types.EmptyTSK)
if actErr == nil && builtin.IsMultisigActor(act.Code) {
return xerrors.Errorf("multisig is an actor account that doesnt have keys to sign transactions. To send a message with a multisig, signers of the multisig need to propose and approve transactions.")
}
return xerrors.Errorf("failed to sign message: %w", err)
}
sigBytes := append([]byte{byte(sig.Type)}, sig.Data...)