From 795c49d16ba5b51fd8641f0894cebe392c742d44 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 21 Jul 2021 15:21:20 +0300 Subject: [PATCH] [#706] ir: Do not require `proxy` hash in notary disabled mode Signed-off-by: Pavel Karpy --- pkg/innerring/innerring.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 64107c32d1..5be3fdcbe5 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -306,7 +306,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error withoutMainNet := cfg.GetBool("without_mainnet") // get all script hashes of contracts - server.contracts, err = parseContracts(cfg, withoutMainNet) + server.contracts, err = parseContracts(cfg, withoutMainNet, server.sideNotaryConfig.disabled) if err != nil { return nil, err } @@ -828,7 +828,7 @@ func createClient(ctx context.Context, p *chainParams, notaryOpts ...client.Nota ) } -func parseContracts(cfg *viper.Viper, withoutMainNet bool) (*contracts, error) { +func parseContracts(cfg *viper.Viper, withoutMainNet, withoutNotary bool) (*contracts, error) { var ( result = new(contracts) err error @@ -846,11 +846,17 @@ func parseContracts(cfg *viper.Viper, withoutMainNet bool) (*contracts, error) { } } + if !withoutNotary { + result.proxy, err = util.Uint160DecodeStringLE(cfg.GetString("contracts.proxy")) + if err != nil { + return nil, fmt.Errorf("ir: can't read proxy script-hash: %w", err) + } + } + netmapContractStr := cfg.GetString("contracts.netmap") balanceContractStr := cfg.GetString("contracts.balance") containerContractStr := cfg.GetString("contracts.container") auditContractStr := cfg.GetString("contracts.audit") - proxyContractStr := cfg.GetString("contracts.proxy") reputationContractStr := cfg.GetString("contracts.reputation") neofsIDContractStr := cfg.GetString("contracts.neofsid") @@ -874,11 +880,6 @@ func parseContracts(cfg *viper.Viper, withoutMainNet bool) (*contracts, error) { return nil, fmt.Errorf("ir: can't read audit script-hash: %w", err) } - result.proxy, err = util.Uint160DecodeStringLE(proxyContractStr) - if err != nil { - return nil, fmt.Errorf("ir: can't read proxy script-hash: %w", err) - } - result.reputation, err = util.Uint160DecodeStringLE(reputationContractStr) if err != nil { return nil, fmt.Errorf("ir: can't read reputation script-hash: %w", err)