[#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:
Alex Vanin 2021-03-18 18:44:23 +03:00 committed by Alex Vanin
parent b9892edd6e
commit 5149a701f3

View file

@ -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 &notaryCfg{ return &notaryCfg{
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 = &notary{ c.notary = &notary{
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 {