[#706] ir: Do not require proxy
hash in notary disabled mode
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
a2cb9cbc49
commit
795c49d16b
1 changed files with 9 additions and 8 deletions
|
@ -306,7 +306,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error
|
||||||
withoutMainNet := cfg.GetBool("without_mainnet")
|
withoutMainNet := cfg.GetBool("without_mainnet")
|
||||||
|
|
||||||
// get all script hashes of contracts
|
// get all script hashes of contracts
|
||||||
server.contracts, err = parseContracts(cfg, withoutMainNet)
|
server.contracts, err = parseContracts(cfg, withoutMainNet, server.sideNotaryConfig.disabled)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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 (
|
var (
|
||||||
result = new(contracts)
|
result = new(contracts)
|
||||||
err error
|
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")
|
netmapContractStr := cfg.GetString("contracts.netmap")
|
||||||
balanceContractStr := cfg.GetString("contracts.balance")
|
balanceContractStr := cfg.GetString("contracts.balance")
|
||||||
containerContractStr := cfg.GetString("contracts.container")
|
containerContractStr := cfg.GetString("contracts.container")
|
||||||
auditContractStr := cfg.GetString("contracts.audit")
|
auditContractStr := cfg.GetString("contracts.audit")
|
||||||
proxyContractStr := cfg.GetString("contracts.proxy")
|
|
||||||
reputationContractStr := cfg.GetString("contracts.reputation")
|
reputationContractStr := cfg.GetString("contracts.reputation")
|
||||||
neofsIDContractStr := cfg.GetString("contracts.neofsid")
|
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)
|
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)
|
result.reputation, err = util.Uint160DecodeStringLE(reputationContractStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("ir: can't read reputation script-hash: %w", err)
|
return nil, fmt.Errorf("ir: can't read reputation script-hash: %w", err)
|
||||||
|
|
Loading…
Reference in a new issue