mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 03:41:34 +00:00
cli: add description to vote
command on how to unvote
This commit is contained in:
parent
b858be63b4
commit
9340a70aa8
2 changed files with 19 additions and 3 deletions
|
@ -41,7 +41,7 @@ func TestRegisterCandidate(t *testing.T) {
|
|||
require.Equal(t, validatorPriv.PublicKey(), vs[0].Key)
|
||||
require.Equal(t, big.NewInt(0), vs[0].Votes)
|
||||
|
||||
t.Run("Vote", func(t *testing.T) {
|
||||
t.Run("VoteUnvote", func(t *testing.T) {
|
||||
e.In.WriteString("one\r")
|
||||
e.Run(t, "neo-go", "wallet", "candidate", "vote",
|
||||
"--rpc-endpoint", "http://"+e.RPC.Addr,
|
||||
|
@ -55,6 +55,19 @@ func TestRegisterCandidate(t *testing.T) {
|
|||
require.Equal(t, validatorPriv.PublicKey(), vs[0].Key)
|
||||
b, _ := e.Chain.GetGoverningTokenBalance(validatorPriv.GetScriptHash())
|
||||
require.Equal(t, b, vs[0].Votes)
|
||||
|
||||
// unvote
|
||||
e.In.WriteString("one\r")
|
||||
e.Run(t, "neo-go", "wallet", "candidate", "vote",
|
||||
"--rpc-endpoint", "http://"+e.RPC.Addr,
|
||||
"--wallet", validatorWallet,
|
||||
"--address", validatorPriv.Address())
|
||||
e.checkTxPersisted(t)
|
||||
|
||||
vs, err = e.Chain.GetEnrollments()
|
||||
require.Equal(t, 1, len(vs))
|
||||
require.Equal(t, validatorPriv.PublicKey(), vs[0].Key)
|
||||
require.Equal(t, big.NewInt(0), vs[0].Votes)
|
||||
})
|
||||
|
||||
// missing address
|
||||
|
|
|
@ -53,8 +53,11 @@ func newValidatorCommands() []cli.Command {
|
|||
{
|
||||
Name: "vote",
|
||||
Usage: "vote for a validator",
|
||||
UsageText: "vote -w <path> -r <rpc> [-s <timeout>] [-g gas] -a <addr> -c <public key>",
|
||||
Action: handleVote,
|
||||
UsageText: "vote -w <path> -r <rpc> [-s <timeout>] [-g gas] -a <addr> [-c <public key>]",
|
||||
Description: `Votes for a validator by calling "vote" method of a NEO native
|
||||
contract. Do not provide candidate argument to perform unvoting.
|
||||
`,
|
||||
Action: handleVote,
|
||||
Flags: append([]cli.Flag{
|
||||
walletPathFlag,
|
||||
gasFlag,
|
||||
|
|
Loading…
Reference in a new issue