From 6be2688fb44cddf265100db646d02d6e76b3151d Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Wed, 29 Mar 2023 17:22:34 +0300 Subject: [PATCH] [#185] ir: Refactor gas emit Resolve funlen linter for processEmit method Signed-off-by: Dmitrii Stepanov --- pkg/innerring/processors/alphabet/process_emit.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/innerring/processors/alphabet/process_emit.go b/pkg/innerring/processors/alphabet/process_emit.go index 10dcf079..90c484b8 100644 --- a/pkg/innerring/processors/alphabet/process_emit.go +++ b/pkg/innerring/processors/alphabet/process_emit.go @@ -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 {