forked from TrueCloudLab/frostfs-node
Evgenii Stratonikov
0e31c12e63
Drop duplicate entities. Format entities. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com> Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
30 lines
878 B
Go
30 lines
878 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) {
|
|
if !bp.alphabetState.IsAlphabet() {
|
|
bp.log.Info(logs.BalanceNonAlphabetModeIgnoreBalanceLock)
|
|
return
|
|
}
|
|
|
|
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))
|
|
}
|
|
}
|