forked from TrueCloudLab/frostfs-node
Hello, I am a robot. #1
1 changed files with 19 additions and 14 deletions
|
@ -50,15 +50,18 @@ func (ap *Processor) processEmit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
nmNodes := networkMap.Nodes()
|
nmNodes := networkMap.Nodes()
|
||||||
|
nmLen := len(nmNodes)
|
||||||
|
extraLen := len(ap.parsedWallets)
|
||||||
|
|
||||||
ln := len(nmNodes)
|
ap.log.Debug("gas emission",
|
||||||
if ln == 0 {
|
zap.Int("network_map", nmLen),
|
||||||
ap.log.Debug("empty network map, do not emit gas")
|
zap.Int("extra_wallets", extraLen))
|
||||||
|
|
||||||
|
if nmLen+extraLen == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
gasPerNode := fixedn.Fixed8(ap.storageEmission / uint64(ln+len(ap.parsedWallets)))
|
gasPerNode := fixedn.Fixed8(ap.storageEmission / uint64(nmLen+extraLen))
|
||||||
|
|
||||||
for i := range nmNodes {
|
for i := range nmNodes {
|
||||||
keyBytes := nmNodes[i].PublicKey()
|
keyBytes := nmNodes[i].PublicKey()
|
||||||
|
@ -81,16 +84,18 @@ func (ap *Processor) processEmit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ap.morphClient.BatchTransferGas(ap.parsedWallets, gasPerNode)
|
if extraLen != 0 {
|
||||||
if err != nil {
|
err = ap.morphClient.BatchTransferGas(ap.parsedWallets, gasPerNode)
|
||||||
receiversLog := make([]string, len(ap.parsedWallets))
|
if err != nil {
|
||||||
for i, addr := range ap.parsedWallets {
|
receiversLog := make([]string, extraLen)
|
||||||
receiversLog[i] = addr.StringLE()
|
for i, addr := range ap.parsedWallets {
|
||||||
|
receiversLog[i] = addr.StringLE()
|
||||||
|
}
|
||||||
|
ap.log.Warn("can't transfer gas to wallet",
|
||||||
|
zap.Strings("receivers", receiversLog),
|
||||||
|
zap.Int64("amount", int64(gasPerNode)),
|
||||||
|
zap.String("error", err.Error()),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
ap.log.Warn("can't transfer gas to wallet",
|
|
||||||
zap.Strings("receivers", receiversLog),
|
|
||||||
zap.Int64("amount", int64(gasPerNode)),
|
|
||||||
zap.String("error", err.Error()),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue