frostfs-node/pkg/innerring/processors/balance/process_assets.go
Alejandro Lopez ebcc8afbee
All checks were successful
ci/woodpecker/push/pre-commit Pipeline was successful
[#374] Add inner-ring event metrics
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
2023-05-31 10:11:48 +00:00

33 lines
917 B
Go

package balance
import (
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
frostfsContract "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/frostfs"
balanceEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event/balance"
"go.uber.org/zap"
)
// Process lock event by invoking Cheque method in main net to send assets
// back to the withdraw issuer.
func (bp *Processor) processLock(lock *balanceEvent.Lock) bool {
if !bp.alphabetState.IsAlphabet() {
bp.log.Info(logs.BalanceNonAlphabetModeIgnoreBalanceLock)
return true
}
prm := frostfsContract.ChequePrm{}
prm.SetID(lock.ID())
prm.SetUser(lock.User())
prm.SetAmount(bp.converter.ToFixed8(lock.Amount()))
prm.SetLock(lock.LockAccount())
prm.SetHash(lock.TxHash())
err := bp.frostfsClient.Cheque(prm)
if err != nil {
bp.log.Error(logs.BalanceCantSendLockAssetTx, zap.Error(err))
return false
}
return true
}