Skip to content

Commit

Permalink
fix: current-cycle-hash resp type issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tanuj-shardeum authored and afostr committed Jun 17, 2024
1 parent b5333f9 commit 00e6712
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/sync-v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ function syncLatestCycleRecordAndMarker(
activeNodes: P2PTypes.SyncTypes.ActiveNode[]
): ResultAsync<[P2PTypes.CycleCreatorTypes.CycleData, hexstring], Error> {
// run a robust query for the latest cycle record hash
return robustQueryForCycleRecordHash(activeNodes).andThen(({ value: cycleRecordHash, winningNodes }) =>
return robustQueryForCycleRecordHash(activeNodes).andThen(({ value, winningNodes }) =>
// get current cycle record from node
getCurrentCycleDataFromNode(winningNodes[0], cycleRecordHash).andThen((cycleRecord) =>
verifyCycleRecord(cycleRecord, cycleRecordHash).map(
() => [cycleRecord, cycleRecordHash] as [P2PTypes.CycleCreatorTypes.CycleData, hexstring]
getCurrentCycleDataFromNode(winningNodes[0], value.currentCycleHash).andThen((cycleRecord) =>
verifyCycleRecord(cycleRecord, value.currentCycleHash).map(
() => [cycleRecord, value.currentCycleHash] as [P2PTypes.CycleCreatorTypes.CycleData, hexstring]
)
)
)
Expand Down
2 changes: 1 addition & 1 deletion src/sync-v2/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function attemptSimpleFetch<T>(
}

/** Executes a robust query to retrieve the cycle marker from the network. */
export function robustQueryForCycleRecordHash(nodes: ActiveNode[]): RobustQueryResultAsync<hexstring> {
export function robustQueryForCycleRecordHash(nodes: ActiveNode[]): RobustQueryResultAsync<{ currentCycleHash: hexstring }> {
return makeRobustQueryCall(nodes, 'current-cycle-hash')
}

Expand Down

0 comments on commit 00e6712

Please sign in to comment.