[#47] Use less extra gas on netmap contract methods

* 1.0 extra gas for new epoch vote
* 0.5 extra gas for new peer approve

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-10-12 14:34:13 +03:00 committed by Alex Vanin
parent b7ee05088c
commit ade185191b
2 changed files with 7 additions and 2 deletions

View file

@ -29,6 +29,11 @@ const (
// execution stage. Otherwise invocation will fail due to gas limit.
extraFee = 1_5000_0000 // 1.5 Fixed8 gas
// Different methods need different extra fee values, so with this
// constants let's try to minimize spent GAS of inner ring node.
feeHalfGas = 50_000_000 // 0.5 Fixed8 gas
feeOneGas = feeHalfGas * 2 // 1.0 Fixed8 gas
checkIsInnerRingMethod = "isInnerRing"
innerRingListMethod = "innerRingList"
chequeMethod = "cheque"

View file

@ -52,7 +52,7 @@ func SetNewEpoch(cli *client.Client, con util.Uint160, epoch uint64) error {
return client.ErrNilClient
}
return cli.Invoke(con, extraFee, setNewEpochMethod, int64(epoch))
return cli.Invoke(con, feeOneGas, setNewEpochMethod, int64(epoch))
}
// ApprovePeer invokes addPeer method.
@ -61,7 +61,7 @@ func ApprovePeer(cli *client.Client, con util.Uint160, peer []byte) error {
return client.ErrNilClient
}
return cli.Invoke(con, extraFee, approvePeerMethod, peer)
return cli.Invoke(con, feeHalfGas, approvePeerMethod, peer)
}
// UpdatePeerState invokes addPeer method.