From 29ee9ec81e7cbda0741ab57e9f70ff8fc1da16e3 Mon Sep 17 00:00:00 2001 From: zah Date: Thu, 7 Oct 2021 19:30:34 +0300 Subject: [PATCH] Bugfix: don't crash on keystores without description (#2967) --- beacon_chain/validators/keystore_management.nim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/beacon_chain/validators/keystore_management.nim b/beacon_chain/validators/keystore_management.nim index e25463124..33aa3db9f 100644 --- a/beacon_chain/validators/keystore_management.nim +++ b/beacon_chain/validators/keystore_management.nim @@ -62,7 +62,8 @@ proc init*(t: typedesc[ValidatorPrivateItem], privateKey: ValidatorPrivKey, keystore: Keystore): ValidatorPrivateItem = ValidatorPrivateItem( privateKey: privateKey, - description: some(keystore.description[]), + description: if keystore.description == nil: none(string) + else: some(keystore.description[]), path: some(keystore.path), uuid: some(keystore.uuid), version: some(uint64(keystore.version)) @@ -284,7 +285,7 @@ proc loadKeystoreFile*(path: string): KsResult[Keystore] {. except IOError as err: return err("Could not read keystore file") except SerializationError as err: - return err("Could not decode keystore file") + return err("Could not decode keystore file: " & err.formatMsg(path)) proc loadSecretFile*(path: string): KsResult[KeystorePass] {. raises: [Defect].} =