Skip to content

Commit

Permalink
add fix for old ship versions
Browse files Browse the repository at this point in the history
  • Loading branch information
igorls committed Nov 6, 2024
1 parent 5e470be commit ba70e2a
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions src/indexer/connections/state-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,17 @@ export class StateHistorySocket {
if (s.chainId.toLowerCase() === chainId.toLowerCase()) {
return true;
} else {
if (s.chainId) {
hLog(`⚠️⚠️️ Removing SHIP Server ${s.node.url} :: Chain ID mismatch`);
hLog(`⚠️⚠️ Expected: ${chainId}`);
hLog(`⚠️⚠️ Found: ${s.chainId}`);
if (s.chainId === 'N/A') {
hLog(`⚠️⚠️️ SHIP Server ${s.node.url} :: Chain ID not available`);
return true;
} else {
if (s.chainId) {
hLog(`⚠️⚠️️ Removing SHIP Server ${s.node.url} :: Chain ID mismatch`);
hLog(`⚠️⚠️ Expected: ${chainId}`);
hLog(`⚠️⚠️ Found: ${s.chainId}`);
}
return false;
}
return false;
}
});

Expand Down Expand Up @@ -218,9 +223,16 @@ export class StateHistorySocket {
server.traceBeginBlock = result[1].trace_begin_block;
server.traceEndBlock = result[1].trace_end_block;
server.active = true;
clearTimeout(timeout);
tempWS.close();
} else {
hLog(`[WARNING] ${server.node.url} didn't respond chain_id on get_status_result_v0 :: Cannot guarantee data integrity`);
server.chainId = 'N/A';
server.active = true;
server.traceBeginBlock = result[1].trace_begin_block;
server.traceEndBlock = result[1].trace_end_block;
}

clearTimeout(timeout);
tempWS.close();
}
}
});
Expand Down

0 comments on commit ba70e2a

Please sign in to comment.