forked from TrueCloudLab/frostfs-node
[#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:
parent
4d160bd4ab
commit
6be2688fb4
1 changed files with 10 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue