frostfs-node/pkg/innerring/processors/balance/process_assets.go

30 lines
797 B
Go
Raw Permalink Normal View History

2020-07-24 13:54:03 +00:00
package balance
import (
frostfsContract "github.com/TrueCloudLab/frostfs-node/pkg/morph/client/frostfs"
balanceEvent "github.com/TrueCloudLab/frostfs-node/pkg/morph/event/balance"
2020-07-24 13:54:03 +00:00
"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("non alphabet mode, ignore balance lock")
2020-07-24 13:54:03 +00:00
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)
2020-07-24 13:54:03 +00:00
if err != nil {
bp.log.Error("can't send lock asset tx", zap.Error(err))
}
}