[#185] ir: Refactor gas emit

Resolve funlen linter for processEmit method

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-03-29 17:22:34 +03:00 committed by Gitea
parent 4d160bd4ab
commit 6be2688fb4

View file

@ -3,6 +3,7 @@ package alphabet
import (
"crypto/elliptic"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/netmap"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
"go.uber.org/zap"
@ -10,7 +11,6 @@ import (
const emitMethod = "emit"
// nolint: funlen
func (ap *Processor) processEmit() {
index := ap.irList.AlphabetIndex()
if index < 0 {
@ -63,6 +63,12 @@ func (ap *Processor) processEmit() {
gasPerNode := fixedn.Fixed8(ap.storageEmission / uint64(nmLen+extraLen))
ap.transferGasToNetmapNodes(nmNodes, gasPerNode)
ap.transferGasToExtraNodes(extraLen, gasPerNode)
}
func (ap *Processor) transferGasToNetmapNodes(nmNodes []netmap.NodeInfo, gasPerNode fixedn.Fixed8) {
for i := range nmNodes {
keyBytes := nmNodes[i].PublicKey()
@ -83,9 +89,11 @@ func (ap *Processor) processEmit() {
)
}
}
}
func (ap *Processor) transferGasToExtraNodes(extraLen int, gasPerNode fixedn.Fixed8) {
if extraLen != 0 {
err = ap.morphClient.BatchTransferGas(ap.parsedWallets, gasPerNode)
err := ap.morphClient.BatchTransferGas(ap.parsedWallets, gasPerNode)
if err != nil {
receiversLog := make([]string, extraLen)
for i, addr := range ap.parsedWallets {