From 5fbb60a9ed012b55c11c5d1d440aa246efc7fd4b Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 21 Jul 2021 12:25:42 +0300 Subject: [PATCH] cli/wallet: request candidate registration price Hardcoding 1000 is wrong. Inspired by neo-project/neo-node#788. --- cli/wallet/validator.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cli/wallet/validator.go b/cli/wallet/validator.go index cee1ffaf4..0289ae47c 100644 --- a/cli/wallet/validator.go +++ b/cli/wallet/validator.go @@ -90,7 +90,7 @@ func newValidatorCommands() []cli.Command { } func handleRegister(ctx *cli.Context) error { - return handleCandidate(ctx, "registerCandidate", 1001*100000000) // registering costs 1000 GAS + return handleCandidate(ctx, "registerCandidate", 100000000) // 1 additional GAS. } func handleUnregister(ctx *cli.Context) error { @@ -122,6 +122,14 @@ func handleCandidate(ctx *cli.Context, method string, sysGas int64) error { return cli.NewExitError(err, 1) } + if sysGas >= 0 { + regPrice, err := c.GetCandidateRegisterPrice() + if err != nil { + return cli.NewExitError(err, 1) + } + sysGas += regPrice + } + gas := flags.Fixed8FromContext(ctx, "gas") neoContractHash, err := c.GetNativeContractHash(nativenames.Neo) if err != nil {