Catch missing configuration value.

This commit is contained in:
Jim McDonald
2020-11-17 21:43:01 +00:00
parent 0b7a24df6e
commit 757a5e1492

View File

@@ -46,9 +46,15 @@ func Network(ctx context.Context, eth2Client eth2client.Service) (string, error)
} else if provider, isProvider := eth2Client.(eth2client.SpecProvider); isProvider {
config, err := provider.Spec(ctx)
if err != nil {
return "", errors.Wrap(err, "failed to obtain deposit contract address")
return "", errors.Wrap(err, "failed to obtain chain specification")
}
if config == nil {
return "", errors.New("failed to return chain specification")
}
depositContractAddress, exists := config["DEPOSIT_CONTRACT_ADDRESS"]
if exists {
address = depositContractAddress.([]byte)
}
address = config["DEPOSIT_CONTRACT_ADDRESS"].([]byte)
}
return network(address), nil