forked from TrueCloudLab/frostfs-node
[#433] Remove notary extra fee
`client.CalculateNotaryFee` now calculates precise fee value. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
b9892edd6e
commit
5149a701f3
1 changed files with 10 additions and 23 deletions
|
@ -32,8 +32,6 @@ type (
|
||||||
}
|
}
|
||||||
|
|
||||||
notaryCfg struct {
|
notaryCfg struct {
|
||||||
extraVerifyFee int64
|
|
||||||
|
|
||||||
txValidTime, roundTime, fallbackTime uint32
|
txValidTime, roundTime, fallbackTime uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +39,6 @@ type (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
defaultNotaryExtraFee = 1000_0000
|
|
||||||
defaultNotaryValidTime = 50
|
defaultNotaryValidTime = 50
|
||||||
defaultNotaryRoundTime = 100
|
defaultNotaryRoundTime = 100
|
||||||
defaultNotaryFallbackTime = 40
|
defaultNotaryFallbackTime = 40
|
||||||
|
@ -60,10 +57,9 @@ var (
|
||||||
|
|
||||||
func defaultNotaryConfig() *notaryCfg {
|
func defaultNotaryConfig() *notaryCfg {
|
||||||
return ¬aryCfg{
|
return ¬aryCfg{
|
||||||
extraVerifyFee: defaultNotaryExtraFee,
|
txValidTime: defaultNotaryValidTime,
|
||||||
txValidTime: defaultNotaryValidTime,
|
roundTime: defaultNotaryRoundTime,
|
||||||
roundTime: defaultNotaryRoundTime,
|
fallbackTime: defaultNotaryFallbackTime,
|
||||||
fallbackTime: defaultNotaryFallbackTime,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,13 +79,12 @@ func (c *Client) EnableNotarySupport(proxy, netmap util.Uint160, opts ...NotaryO
|
||||||
}
|
}
|
||||||
|
|
||||||
c.notary = ¬ary{
|
c.notary = ¬ary{
|
||||||
notary: notaryContract,
|
notary: notaryContract,
|
||||||
proxy: proxy,
|
proxy: proxy,
|
||||||
netmap: netmap,
|
netmap: netmap,
|
||||||
extraVerifyFee: cfg.extraVerifyFee,
|
txValidTime: cfg.txValidTime,
|
||||||
txValidTime: cfg.txValidTime,
|
roundTime: cfg.roundTime,
|
||||||
roundTime: cfg.roundTime,
|
fallbackTime: cfg.fallbackTime,
|
||||||
fallbackTime: cfg.fallbackTime,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -234,7 +229,7 @@ func (c *Client) NotaryInvoke(contract util.Uint160, method string, args ...inte
|
||||||
// add network fee for cosigners
|
// add network fee for cosigners
|
||||||
err = c.client.AddNetworkFee(
|
err = c.client.AddNetworkFee(
|
||||||
mainTx,
|
mainTx,
|
||||||
notaryFee+c.notary.extraVerifyFee,
|
notaryFee,
|
||||||
c.notaryAccounts(multiaddrAccount)...,
|
c.notaryAccounts(multiaddrAccount)...,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -443,14 +438,6 @@ func mn(ir []*keys.PublicKey) (m int, n int) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithExtraVerifyFee returns a notary support option for client
|
|
||||||
// that specifies extra fee to check witness of proxy contract.
|
|
||||||
func WithExtraVerifyFee(fee int64) NotaryOption {
|
|
||||||
return func(c *notaryCfg) {
|
|
||||||
c.extraVerifyFee = fee
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// WithTxValidTime returns a notary support option for client
|
// WithTxValidTime returns a notary support option for client
|
||||||
// that specifies minimum amount of blocks when mainTx will be valid.
|
// that specifies minimum amount of blocks when mainTx will be valid.
|
||||||
func WithTxValidTime(t uint32) NotaryOption {
|
func WithTxValidTime(t uint32) NotaryOption {
|
||||||
|
|
Loading…
Reference in a new issue