Skip to content

Commit fd089e4

Browse files
committed
fix: correct chipnet port, improve unresponsive node warnings
1 parent f04264a commit fd089e4

File tree

3 files changed

+14
-29
lines changed

3 files changed

+14
-29
lines changed

charts/chaingraph/templates/bitcoin-cash-node-chipnet-service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ metadata:
99
spec:
1010
ports:
1111
- name: chipnet-p2p
12-
port: 28333
12+
port: 48333
1313
type: ClusterIP
1414
selector:
1515
app: bitcoin-cash-node-chipnet

src/agent.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,13 @@ export class Agent {
288288

289289
scheduledBlockBufferFill = false;
290290

291+
/**
292+
* The next second after which to log another warning that one or more nodes
293+
* are unresponsive.
294+
*/
295+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
296+
warnAfterDelaySecond = 5;
297+
291298
syncedAtLastFillAttempt = false;
292299

293300
/**
@@ -701,29 +708,28 @@ export class Agent {
701708
* noticed, and avoids wasting cluster bandwidth when a node configuration
702709
* issue requires that Chaingraph be restarted.
703710
*/
711+
704712
checkInitialization() {
705713
const uninitializedNodes = Object.entries(this.nodes).reduce<string[]>(
706714
(nodes, [id, node]) =>
707715
node.internalId === undefined ? [...nodes, id] : nodes,
708716
[]
709717
);
710718
if (uninitializedNodes.length > 0 || !this.blockDbRestored) {
711-
// warn if more than 5 seconds have passed since this.startTime
712-
const warnAfterDelayMs = 5000;
713719
const second = 1000;
714720
const currentDelay = Date.now() - this.startTime.getTime();
715-
if (currentDelay > warnAfterDelayMs) {
721+
const currentDelaySecondsRounded = Math.round(currentDelay / second);
722+
if (this.warnAfterDelaySecond < currentDelaySecondsRounded) {
723+
this.warnAfterDelaySecond = currentDelaySecondsRounded;
716724
if (this.blockDbRestored) {
717725
this.logger.warn(
718-
`The following nodes are taking longer than ${Math.round(
719-
currentDelay / second
720-
)} seconds to initialize and may be misconfigured: ${uninitializedNodes.join(
726+
`The following nodes are taking longer than ${currentDelaySecondsRounded} seconds to initialize and may be either misconfigured or unresponsive: ${uninitializedNodes.join(
721727
','
722728
)}`
723729
);
724730
} else {
725731
this.logger.warn(
726-
`Could not restore block hashes from the database within 5 seconds. There may be a database configuration or connectivity problem.`
732+
`Could not restore block hashes from the database after ${currentDelaySecondsRounded} seconds. There may be a database configuration or connectivity problem.`
727733
);
728734
}
729735
}

src/logging.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,27 +68,6 @@ export const instantiateLogger = () => {
6868
} mode at level '${chaingraphLogLevelStdout}'.`
6969
);
7070

71-
switch (chaingraphLogLevelStdout) {
72-
case 'fatal':
73-
logger.fatal(`Logging level set to: fatal`);
74-
break;
75-
case 'error':
76-
logger.error(`Logging level set to: error`);
77-
break;
78-
case 'warn':
79-
logger.warn(`Logging level set to: warn`);
80-
break;
81-
case 'info':
82-
logger.info(`Logging level set to: info`);
83-
break;
84-
case 'debug':
85-
logger.debug(`Logging level set to: debug`);
86-
break;
87-
case 'trace':
88-
logger.trace(`Logging level set to: trace`);
89-
break;
90-
}
91-
9271
if (chaingraphLogPath !== false) {
9372
logger.info(
9473
`Also logging at level '${chaingraphLogLevelPath}' to: ${chaingraphLogPath}`

0 commit comments

Comments
 (0)