diff --git a/cli/multisig_test.go b/cli/multisig_test.go index b3d57ac68..bbd95b3de 100644 --- a/cli/multisig_test.go +++ b/cli/multisig_test.go @@ -91,6 +91,12 @@ func TestSignMultisigTx(t *testing.T) { }) } + // missing address + e.RunWithError(t, "neo-go", "wallet", "sign", + "--rpc-endpoint", "http://"+e.RPC.Addr, + "--wallet", wallet2Path, + "--in", txPath, "--out", txPath) + e.In.WriteString("pass\r") e.Run(t, "neo-go", "wallet", "sign", "--rpc-endpoint", "http://"+e.RPC.Addr, @@ -127,7 +133,7 @@ func TestSignMultisigTx(t *testing.T) { e.In.WriteString("pass\r") e.Run(t, "neo-go", "contract", "invokefunction", "--rpc-endpoint", "http://"+e.RPC.Addr, - "--wallet", wallet1Path, "--address", multisigAddr, + "--wallet", wallet1Path, "--address", multisigHash.StringLE(), // test with scripthash instead of address "--out", txPath, e.Chain.GoverningTokenHash().StringLE(), "transfer", "bytes:"+multisigHash.StringBE(), diff --git a/cli/wallet/multisig.go b/cli/wallet/multisig.go index 0ff3d4349..974c3adae 100644 --- a/cli/wallet/multisig.go +++ b/cli/wallet/multisig.go @@ -3,6 +3,7 @@ package wallet import ( "fmt" + "github.com/nspcc-dev/neo-go/cli/flags" "github.com/nspcc-dev/neo-go/cli/options" "github.com/nspcc-dev/neo-go/cli/paramcontext" "github.com/nspcc-dev/neo-go/pkg/core/transaction" @@ -21,12 +22,11 @@ func signStoredTransaction(ctx *cli.Context) error { if err != nil { return cli.NewExitError(err, 1) } - addr := ctx.String("address") - sh, err := address.StringToUint160(addr) - if err != nil { - return cli.NewExitError(fmt.Errorf("invalid address: %w", err), 1) + addrFlag := ctx.Generic("address").(*flags.Address) + if !addrFlag.IsSet { + return cli.NewExitError("address was not provided", 1) } - acc, err := getDecryptedAccount(ctx, wall, sh) + acc, err := getDecryptedAccount(ctx, wall, addrFlag.Uint160()) if err != nil { return cli.NewExitError(err, 1) } diff --git a/cli/wallet/wallet.go b/cli/wallet/wallet.go index 7081e4937..a3cfd48a9 100644 --- a/cli/wallet/wallet.go +++ b/cli/wallet/wallet.go @@ -74,7 +74,7 @@ func NewCommands() []cli.Command { walletPathFlag, outFlag, inFlag, - cli.StringFlag{ + flags.AddressFlag{ Name: "address, a", Usage: "Address to use", },