Skip to content

Commit

Permalink
[release] bump coordinator v2.1.1
Browse files Browse the repository at this point in the history
fix validating node type for chain family polkadot
  • Loading branch information
icezohu authored May 31, 2024
2 parents 952f177 + 4cd977e commit 01c15cd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/indexer-coordinator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@subql/indexer-coordinator",
"version": "2.1.1-0",
"version": "2.1.1",
"description": "",
"author": "SubQuery",
"license": "Apache-2.0",
Expand Down
15 changes: 12 additions & 3 deletions apps/indexer-coordinator/src/project/rpc.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,22 @@ export class RpcFamilySubstrate extends RpcFamily {
withNodeType(nodeType: string): IRpcFamily {
this.actions.push(async () => {
const result = await getRpcRequestFunction(this.endpoint)(
this.endpoint,
'chain_getBlockHash',
[0]
);
if (result.data.error) {
throw new Error(`Request chain_getBlockHash failed: ${result.data.error.message}`);
}
const genesisHashFromRpc = result.data.result;
const result2 = await getRpcRequestFunction(this.endpoint)(
this.endpoint,
'state_getRuntimeVersion',
['0x2d7cfacc14a1603ea1dbb207ae07516224d25fff5310058d1c371f2acac5143e']
[genesisHashFromRpc]
);
let nodeTypeFromRpc: string;
if (result.data.error) {
logger.debug(`Request state_getRuntimeVersion failed: ${result.data.error.message}`);
if (result2.data.error) {
logger.debug(`Request state_getRuntimeVersion failed: ${result2.data.error.message}`);
nodeTypeFromRpc = 'full';
} else {
nodeTypeFromRpc = 'archive';
Expand Down

0 comments on commit 01c15cd

Please sign in to comment.