[#1170] config: Delete notification endpoints

Also, change `http` to `ws` in examples.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-02-10 19:47:26 +03:00 committed by Alex Vanin
parent 3e45b4a085
commit fdf1338d65
7 changed files with 2 additions and 56 deletions

View file

@ -37,19 +37,6 @@ func RPCEndpoint(c *config.Config) []string {
return v
}
// NotificationEndpoint returns list of values of "notification_endpoint" config
// parameter from "morph" section.
//
// Throws panic if list is empty.
func NotificationEndpoint(c *config.Config) []string {
v := config.StringSliceSafe(c.Sub(subsection), "notification_endpoint")
if len(v) == 0 {
panic(fmt.Errorf("no morph chain notification endpoints, see `morph.notification_endpoint` section"))
}
return v
}
// DialTimeout returns value of "dial_timeout" config parameter
// from "morph" section.
//
@ -68,14 +55,3 @@ func DialTimeout(c *config.Config) time.Duration {
func DisableCache(c *config.Config) bool {
return config.BoolSafe(c.Sub(subsection), "disable_cache")
}
// MaxConnPerHost return value of "max_connections_per_host" config
// parameter from "morph" section.
func MaxConnPerHost(c *config.Config) int {
v := config.Uint32Safe(c.Sub(subsection), "max_connections_per_host")
if v > 0 {
return int(v)
}
return MaxConnPerHostDefault
}

View file

@ -15,21 +15,14 @@ func TestMorphSection(t *testing.T) {
empty := configtest.EmptyConfig()
require.Panics(t, func() { morphconfig.RPCEndpoint(empty) })
require.Panics(t, func() { morphconfig.NotificationEndpoint(empty) })
require.Equal(t, morphconfig.DialTimeoutDefault, morphconfig.DialTimeout(empty))
require.Equal(t, false, morphconfig.DisableCache(empty))
require.Equal(t, 10, morphconfig.MaxConnPerHost(empty))
})
const path = "../../../../config/example/node"
var (
rpcs = []string{
"https://rpc1.morph.fs.neo.org:40341",
"https://rpc2.morph.fs.neo.org:40341",
}
wss = []string{
"wss://rpc1.morph.fs.neo.org:40341/ws",
"wss://rpc2.morph.fs.neo.org:40341/ws",
}
@ -37,10 +30,8 @@ func TestMorphSection(t *testing.T) {
var fileConfigTest = func(c *config.Config) {
require.Equal(t, rpcs, morphconfig.RPCEndpoint(c))
require.Equal(t, wss, morphconfig.NotificationEndpoint(c))
require.Equal(t, 30*time.Second, morphconfig.DialTimeout(c))
require.Equal(t, true, morphconfig.DisableCache(c))
require.Equal(t, 11, morphconfig.MaxConnPerHost(c))
}
configtest.ForEachFileType(path, fileConfigTest)