[#863] node: Prevent panic about missing Neo RPC endpoints

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-09-29 12:25:36 +03:00 committed by Alex Vanin
parent 8efea6e066
commit 50c4c5116d

View file

@ -37,6 +37,10 @@ func initMorphComponents(c *cfg) {
var err error
fn := func(addresses []string, dialTimeout time.Duration, handler func(*client.Client)) {
if len(addresses) == 0 {
fatalOnErr(errors.New("missing Neo RPC endpoints"))
}
crand := rand.New() // math/rand with cryptographic source
crand.Shuffle(len(addresses), func(i, j int) {
addresses[i], addresses[j] = addresses[j], addresses[i]