cli/wallet: request candidate registration price
Hardcoding 1000 is wrong. Inspired by neo-project/neo-node#788.
This commit is contained in:
parent
5bdcd4c241
commit
5fbb60a9ed
1 changed files with 9 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue