[#128] innerring: Add GAS pouring mechanism for a configurable list of wallets

Signed-off-by: Artem Tataurov <a.tataurov@yadro.com>
This commit is contained in:
Artem Tataurov 2023-03-09 16:19:39 +03:00 committed by Gitea
parent abd21f8099
commit db3ccd2762
7 changed files with 83 additions and 1 deletions

View file

@ -57,7 +57,7 @@ func (ap *Processor) processEmit() {
return
}
gasPerNode := fixedn.Fixed8(ap.storageEmission / uint64(ln))
gasPerNode := fixedn.Fixed8(ap.storageEmission / uint64(ln+len(ap.parsedWallets)))
for i := range nmNodes {
keyBytes := nmNodes[i].PublicKey()
@ -79,4 +79,17 @@ func (ap *Processor) processEmit() {
)
}
}
err = ap.morphClient.BatchTransferGas(ap.parsedWallets, gasPerNode)
if err != nil {
receiversLog := make([]string, len(ap.parsedWallets))
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()),
)
}
}