forked from TrueCloudLab/frostfs-node
[#1405] ir: Fix settlement log message
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>support/v0.30
parent
b11f35a5c7
commit
4be5dce848
|
@ -10,6 +10,7 @@ Changelog for NeoFS Node
|
||||||
- Do not ask for contract wallet password twice (#1346)
|
- Do not ask for contract wallet password twice (#1346)
|
||||||
- Do not update NNS group if the key is the same (#1375)
|
- Do not update NNS group if the key is the same (#1375)
|
||||||
- Make LOCODE messages more descriptive (#1394)
|
- Make LOCODE messages more descriptive (#1394)
|
||||||
|
- Basic income transfer's incorrect log message (#1374)
|
||||||
|
|
||||||
## [0.28.1] - 2022-05-05
|
## [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
|
// create settlement processor dependencies
|
||||||
settlementDeps := &settlementDeps{
|
settlementDeps := settlementDeps{
|
||||||
globalConfig: globalConfig,
|
globalConfig: globalConfig,
|
||||||
log: server.log,
|
log: server.log,
|
||||||
cnrSrc: cntClient.AsContainerSource(cnrClient),
|
cnrSrc: cntClient.AsContainerSource(cnrClient),
|
||||||
|
@ -610,10 +610,12 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper, errChan chan<-
|
||||||
balanceClient: server.balanceClient,
|
balanceClient: server.balanceClient,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settlementDeps.settlementCtx = auditSettlementContext
|
||||||
auditCalcDeps := &auditSettlementDeps{
|
auditCalcDeps := &auditSettlementDeps{
|
||||||
settlementDeps: settlementDeps,
|
settlementDeps: settlementDeps,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settlementDeps.settlementCtx = basicIncomeSettlementContext
|
||||||
basicSettlementDeps := &basicIncomeSettlementDeps{
|
basicSettlementDeps := &basicIncomeSettlementDeps{
|
||||||
settlementDeps: settlementDeps,
|
settlementDeps: settlementDeps,
|
||||||
cnrClient: cnrClient,
|
cnrClient: cnrClient,
|
||||||
|
|
|
@ -35,6 +35,11 @@ type globalConfig interface {
|
||||||
AuditFee() (uint64, error)
|
AuditFee() (uint64, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
auditSettlementContext = "audit"
|
||||||
|
basicIncomeSettlementContext = "basic income"
|
||||||
|
)
|
||||||
|
|
||||||
type settlementDeps struct {
|
type settlementDeps struct {
|
||||||
globalConfig
|
globalConfig
|
||||||
|
|
||||||
|
@ -49,14 +54,16 @@ type settlementDeps struct {
|
||||||
clientCache *ClientCache
|
clientCache *ClientCache
|
||||||
|
|
||||||
balanceClient *balanceClient.Client
|
balanceClient *balanceClient.Client
|
||||||
|
|
||||||
|
settlementCtx string
|
||||||
}
|
}
|
||||||
|
|
||||||
type auditSettlementDeps struct {
|
type auditSettlementDeps struct {
|
||||||
*settlementDeps
|
settlementDeps
|
||||||
}
|
}
|
||||||
|
|
||||||
type basicIncomeSettlementDeps struct {
|
type basicIncomeSettlementDeps struct {
|
||||||
*settlementDeps
|
settlementDeps
|
||||||
cnrClient *containerClient.Client
|
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) {
|
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(
|
log := s.log.With(
|
||||||
zap.Stringer("sender", sender),
|
zap.Stringer("sender", sender),
|
||||||
zap.Stringer("recipient", recipient),
|
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)
|
err := s.balanceClient.TransferX(params)
|
||||||
if err != nil {
|
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()),
|
zap.String("error", err.Error()),
|
||||||
)
|
)
|
||||||
|
|
||||||
return
|
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) {
|
func (b basicIncomeSettlementDeps) BasicRate() (uint64, error) {
|
||||||
|
|
Loading…
Reference in New Issue