[#1405] ir: Fix settlement log message
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
b11f35a5c7
commit
4be5dce848
3 changed files with 19 additions and 5 deletions
|
@ -10,6 +10,7 @@ Changelog for NeoFS Node
|
|||
- Do not ask for contract wallet password twice (#1346)
|
||||
- Do not update NNS group if the key is the same (#1375)
|
||||
- Make LOCODE messages more descriptive (#1394)
|
||||
- Basic income transfer's incorrect log message (#1374)
|
||||
|
||||
## [0.28.1] - 2022-05-05
|
||||
|
||||
|
|
|
@ -600,7 +600,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper, errChan chan<-
|
|||
}
|
||||
|
||||
// create settlement processor dependencies
|
||||
settlementDeps := &settlementDeps{
|
||||
settlementDeps := settlementDeps{
|
||||
globalConfig: globalConfig,
|
||||
log: server.log,
|
||||
cnrSrc: cntClient.AsContainerSource(cnrClient),
|
||||
|
@ -610,10 +610,12 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper, errChan chan<-
|
|||
balanceClient: server.balanceClient,
|
||||
}
|
||||
|
||||
settlementDeps.settlementCtx = auditSettlementContext
|
||||
auditCalcDeps := &auditSettlementDeps{
|
||||
settlementDeps: settlementDeps,
|
||||
}
|
||||
|
||||
settlementDeps.settlementCtx = basicIncomeSettlementContext
|
||||
basicSettlementDeps := &basicIncomeSettlementDeps{
|
||||
settlementDeps: settlementDeps,
|
||||
cnrClient: cnrClient,
|
||||
|
|
|
@ -35,6 +35,11 @@ type globalConfig interface {
|
|||
AuditFee() (uint64, error)
|
||||
}
|
||||
|
||||
const (
|
||||
auditSettlementContext = "audit"
|
||||
basicIncomeSettlementContext = "basic income"
|
||||
)
|
||||
|
||||
type settlementDeps struct {
|
||||
globalConfig
|
||||
|
||||
|
@ -49,14 +54,16 @@ type settlementDeps struct {
|
|||
clientCache *ClientCache
|
||||
|
||||
balanceClient *balanceClient.Client
|
||||
|
||||
settlementCtx string
|
||||
}
|
||||
|
||||
type auditSettlementDeps struct {
|
||||
*settlementDeps
|
||||
settlementDeps
|
||||
}
|
||||
|
||||
type basicIncomeSettlementDeps struct {
|
||||
*settlementDeps
|
||||
settlementDeps
|
||||
cnrClient *containerClient.Client
|
||||
}
|
||||
|
||||
|
@ -204,6 +211,10 @@ func (s settlementDeps) ResolveKey(ni common.NodeInfo) (*owner.ID, error) {
|
|||
}
|
||||
|
||||
func (s settlementDeps) Transfer(sender, recipient *owner.ID, amount *big.Int, details []byte) {
|
||||
if s.settlementCtx == "" {
|
||||
panic("unknown settlement deps context")
|
||||
}
|
||||
|
||||
log := s.log.With(
|
||||
zap.Stringer("sender", sender),
|
||||
zap.Stringer("recipient", recipient),
|
||||
|
@ -226,14 +237,14 @@ func (s settlementDeps) Transfer(sender, recipient *owner.ID, amount *big.Int, d
|
|||
|
||||
err := s.balanceClient.TransferX(params)
|
||||
if err != nil {
|
||||
log.Error("could not send transfer transaction for audit",
|
||||
log.Error(fmt.Sprintf("%s: could not send transfer", s.settlementCtx),
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
log.Debug("transfer transaction for audit was successfully sent")
|
||||
log.Debug(fmt.Sprintf("%s: transfer was successfully sent", s.settlementCtx))
|
||||
}
|
||||
|
||||
func (b basicIncomeSettlementDeps) BasicRate() (uint64, error) {
|
||||
|
|
Loading…
Reference in a new issue