Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: msig cli: Check for existing signers in add-propose #8833

Merged
merged 11 commits into from
Jul 7, 2022
33 changes: 33 additions & 0 deletions cli/multisig.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,39 @@ var msigAddProposeCmd = &cli.Command{
from = defaddr
}

store := adt.WrapStore(ctx, cbor.NewCborStore(blockstore.NewAPIBlockstore(api)))

head, err := api.ChainHead(ctx)
if err != nil {
return err
}

act, err := api.StateGetActor(ctx, msig, head.Key())
if err != nil {
return err
}

mstate, err := multisig.Load(store, act)
if err != nil {
return err
}

signers, err := mstate.Signers()
if err != nil {
return err
}

addrId, err := api.StateLookupID(ctx, addr, types.EmptyTSK)
if err != nil {
return err
}

for _, s := range signers {
if s == addrId {
return fmt.Errorf("The add a signer address(%s) is included in the signers", addr.String())
magik6k marked this conversation as resolved.
Show resolved Hide resolved
}
}

proto, err := api.MsigAddPropose(ctx, msig, from, addr, cctx.Bool("increase-threshold"))
if err != nil {
return err
Expand Down