From 21b854f30b464002922b7a83cdfb07151b322692 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 20 Oct 2023 16:55:36 +0300 Subject: [PATCH] neofs-adm: drop unused deprecated fee-related methods Signed-off-by: Roman Khimov --- .../internal/modules/morph/local_client.go | 26 ------------------- .../internal/modules/morph/n3client.go | 2 -- 2 files changed, 28 deletions(-) diff --git a/cmd/neofs-adm/internal/modules/morph/local_client.go b/cmd/neofs-adm/internal/modules/morph/local_client.go index 3b3a02daf6c..153d50082ca 100644 --- a/cmd/neofs-adm/internal/modules/morph/local_client.go +++ b/cmd/neofs-adm/internal/modules/morph/local_client.go @@ -165,11 +165,6 @@ func (l *localClient) InvokeFunction(h util.Uint160, method string, sPrm []smart return invokeFunction(l, h, method, pp, ss) } -func (l *localClient) CalculateNotaryFee(_ uint8) (int64, error) { - // not used by `morph init` command - panic("unexpected call") -} - func (l *localClient) SignAndPushP2PNotaryRequest(_ *transaction.Transaction, _ []byte, _ int64, _ int64, _ uint32, _ *wallet.Account) (*payload.P2PNotaryRequest, error) { // not used by `morph init` command panic("unexpected call") @@ -242,27 +237,6 @@ func (l *localClient) CalculateNetworkFee(tx *transaction.Transaction) (int64, e return netFee, nil } -// AddNetworkFee adds network fee for each witness script and optional extra -// network fee to transaction. `accs` is an array signer's accounts. -// Copied from neo-go with minor corrections (no need to support contract signers): -// https://github.com/nspcc-dev/neo-go/blob/6ff11baa1b9e4c71ef0d1de43b92a8c541ca732c/pkg/rpc/client/rpc.go#L960 -func (l *localClient) AddNetworkFee(tx *transaction.Transaction, extraFee int64, accs ...*wallet.Account) error { - if len(tx.Signers) != len(accs) { - return errors.New("number of signers must match number of scripts") - } - - size := io.GetVarSize(tx) - ef := l.bc.GetBaseExecFee() - for i := range tx.Signers { - netFee, sizeDelta := fee.Calculate(ef, accs[i].Contract.Script) - tx.NetworkFee += netFee - size += sizeDelta - } - - tx.NetworkFee += int64(size)*l.bc.FeePerByte() + extraFee - return nil -} - func (l *localClient) InvokeScript(script []byte, signers []transaction.Signer) (*result.Invoke, error) { lastBlock, err := l.bc.GetBlock(l.bc.CurrentBlockHash()) if err != nil { diff --git a/cmd/neofs-adm/internal/modules/morph/n3client.go b/cmd/neofs-adm/internal/modules/morph/n3client.go index 3b93d2e28bf..34089cd16cc 100644 --- a/cmd/neofs-adm/internal/modules/morph/n3client.go +++ b/cmd/neofs-adm/internal/modules/morph/n3client.go @@ -35,9 +35,7 @@ type Client interface { GetVersion() (*result.Version, error) SendRawTransaction(*transaction.Transaction) (util.Uint256, error) GetCommittee() (keys.PublicKeys, error) - CalculateNotaryFee(uint8) (int64, error) CalculateNetworkFee(tx *transaction.Transaction) (int64, error) - AddNetworkFee(*transaction.Transaction, int64, ...*wallet.Account) error SignAndPushInvocationTx([]byte, *wallet.Account, int64, fixedn.Fixed8, []rpcclient.SignerAccount) (util.Uint256, error) SignAndPushP2PNotaryRequest(*transaction.Transaction, []byte, int64, int64, uint32, *wallet.Account) (*payload.P2PNotaryRequest, error) }