forked from TrueCloudLab/neoneo-go
cli: check address flag is set for validator-related commands
This commit is contained in:
parent
ff2b051646
commit
90b054afd0
2 changed files with 16 additions and 0 deletions
|
@ -23,6 +23,11 @@ func TestRegisterCandidate(t *testing.T) {
|
|||
"GAS:"+validatorPriv.Address()+":10000")
|
||||
e.checkTxPersisted(t)
|
||||
|
||||
// missing address
|
||||
e.RunWithError(t, "neo-go", "wallet", "candidate", "register",
|
||||
"--rpc-endpoint", "http://"+e.RPC.Addr,
|
||||
"--wallet", validatorWallet)
|
||||
|
||||
e.In.WriteString("one\r")
|
||||
e.Run(t, "neo-go", "wallet", "candidate", "register",
|
||||
"--rpc-endpoint", "http://"+e.RPC.Addr,
|
||||
|
@ -52,6 +57,11 @@ func TestRegisterCandidate(t *testing.T) {
|
|||
require.Equal(t, b, vs[0].Votes)
|
||||
})
|
||||
|
||||
// missing address
|
||||
e.RunWithError(t, "neo-go", "wallet", "candidate", "unregister",
|
||||
"--rpc-endpoint", "http://"+e.RPC.Addr,
|
||||
"--wallet", validatorWallet)
|
||||
|
||||
e.In.WriteString("one\r")
|
||||
e.Run(t, "neo-go", "wallet", "candidate", "unregister",
|
||||
"--rpc-endpoint", "http://"+e.RPC.Addr,
|
||||
|
|
|
@ -87,6 +87,9 @@ func handleCandidate(ctx *cli.Context, method string, sysGas int64) error {
|
|||
defer wall.Close()
|
||||
|
||||
addrFlag := ctx.Generic("address").(*flags.Address)
|
||||
if !addrFlag.IsSet {
|
||||
return cli.NewExitError("address was not provided", 1)
|
||||
}
|
||||
addr := addrFlag.Uint160()
|
||||
acc, err := getDecryptedAccount(ctx, wall, addr)
|
||||
if err != nil {
|
||||
|
@ -139,6 +142,9 @@ func handleVote(ctx *cli.Context) error {
|
|||
defer wall.Close()
|
||||
|
||||
addrFlag := ctx.Generic("address").(*flags.Address)
|
||||
if !addrFlag.IsSet {
|
||||
return cli.NewExitError("address was not provided", 1)
|
||||
}
|
||||
addr := addrFlag.Uint160()
|
||||
acc, err := getDecryptedAccount(ctx, wall, addr)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue