[#1636] ir: Listen balance contract in balance processor

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
neofs-adm-fix-update
Alex Vanin 2022-07-28 18:04:07 +03:00 committed by fyrchik
parent 8162b27264
commit 71fd86f220
3 changed files with 8 additions and 2 deletions

View File

@ -46,6 +46,7 @@ Changelog for NeoFS Node
- `neofs-adm` now registers candidates during initialization in a single transaction (#1608)
### Fixed
- Invalid smart contract address in balance contract listener (#1636)
- Shard now can start in degraded mode if the metabase is unavailable (#1559)
- Shard can now be disabled completely on init failure (#1559)

View File

@ -749,6 +749,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper, errChan chan<-
Log: log,
PoolSize: cfg.GetInt("workers.balance"),
NeoFSClient: neofsCli,
BalanceSC: server.contracts.balance,
AlphabetState: server,
Converter: &server.precision,
})

View File

@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"github.com/nspcc-dev/neo-go/pkg/util"
neofscontract "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofs"
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
balanceEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/balance"
@ -27,6 +28,7 @@ type (
log *zap.Logger
pool *ants.Pool
neofsClient *neofscontract.Client
balanceSC util.Uint160
alphabetState AlphabetState
converter PrecisionConverter
}
@ -36,6 +38,7 @@ type (
Log *zap.Logger
PoolSize int
NeoFSClient *neofscontract.Client
BalanceSC util.Uint160
AlphabetState AlphabetState
Converter PrecisionConverter
}
@ -67,6 +70,7 @@ func New(p *Params) (*Processor, error) {
log: p.Log,
pool: pool,
neofsClient: p.NeoFSClient,
balanceSC: p.BalanceSC,
alphabetState: p.AlphabetState,
converter: p.Converter,
}, nil
@ -79,7 +83,7 @@ func (bp *Processor) ListenerNotificationParsers() []event.NotificationParserInf
// new lock event
lock := event.NotificationParserInfo{}
lock.SetType(lockNotification)
lock.SetScriptHash(bp.neofsClient.ContractAddress())
lock.SetScriptHash(bp.balanceSC)
lock.SetParser(balanceEvent.ParseLock)
parsers = append(parsers, lock)
@ -93,7 +97,7 @@ func (bp *Processor) ListenerNotificationHandlers() []event.NotificationHandlerI
// lock handler
lock := event.NotificationHandlerInfo{}
lock.SetType(lockNotification)
lock.SetScriptHash(bp.neofsClient.ContractAddress())
lock.SetScriptHash(bp.balanceSC)
lock.SetHandler(bp.handleLock)
handlers = append(handlers, lock)