diff --git a/CHANGELOG.md b/CHANGELOG.md index 2478d62ac..65ca7558d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 34a36ca3e..19dd98e27 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -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, diff --git a/pkg/innerring/settlement.go b/pkg/innerring/settlement.go index 597d7de93..713ae3a07 100644 --- a/pkg/innerring/settlement.go +++ b/pkg/innerring/settlement.go @@ -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) {