From f8ee54db0701179a928b88c049e82bb44ade27b6 Mon Sep 17 00:00:00 2001 From: Troy Kessler Date: Wed, 12 Jun 2024 16:48:27 +0200 Subject: [PATCH] chore: added better logs --- common/protocol/src/index.ts | 2 +- common/protocol/src/methods/checks/isDataAvailable.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/common/protocol/src/index.ts b/common/protocol/src/index.ts index 39532c34..11bfcb47 100644 --- a/common/protocol/src/index.ts +++ b/common/protocol/src/index.ts @@ -276,7 +276,7 @@ export class Validator { ) .option( "--skip-data-availability-check", - "Skip data availability check and join pool instantly without waiting for the data source. WARNING: Only use this if you know what you are doing" + "Skip data availability check and join pool instantly without waiting for the data source. WARNING: Only use this if you know what you are doing since this can lead to timeout slashes" ) .action((options) => { this.start(options); diff --git a/common/protocol/src/methods/checks/isDataAvailable.ts b/common/protocol/src/methods/checks/isDataAvailable.ts index 21bdc72f..48a3e973 100644 --- a/common/protocol/src/methods/checks/isDataAvailable.ts +++ b/common/protocol/src/methods/checks/isDataAvailable.ts @@ -11,6 +11,8 @@ import { Validator, standardizeError } from "../.."; * @return {Promise} */ export async function isDataAvailable(this: Validator): Promise { + let nextKey = ""; + try { // log debug method if (this.pool.data!.current_key) { @@ -18,7 +20,7 @@ export async function isDataAvailable(this: Validator): Promise { } // get the next key to node has to fetch - const nextKey = this.pool.data!.current_key + nextKey = this.pool.data!.current_key ? await this.runtime.nextKey(this, this.pool.data!.current_key) : this.pool.data!.start_key; @@ -45,7 +47,9 @@ export async function isDataAvailable(this: Validator): Promise { return true; } catch (err) { - this.logger.warn(`Data not available for next key. Retrying in 60s ...`); + this.logger.warn( + `Data not available for next key ${nextKey}. Retrying in 60s ...` + ); this.logger.warn(standardizeError(err)); return false;