diff --git a/src/sync-v2/index.ts b/src/sync-v2/index.ts index d13359c4..cfc1ab13 100644 --- a/src/sync-v2/index.ts +++ b/src/sync-v2/index.ts @@ -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] ) ) ) diff --git a/src/sync-v2/queries.ts b/src/sync-v2/queries.ts index 57e4dae5..46e1b96b 100644 --- a/src/sync-v2/queries.ts +++ b/src/sync-v2/queries.ts @@ -119,7 +119,7 @@ function attemptSimpleFetch( } /** Executes a robust query to retrieve the cycle marker from the network. */ -export function robustQueryForCycleRecordHash(nodes: ActiveNode[]): RobustQueryResultAsync { +export function robustQueryForCycleRecordHash(nodes: ActiveNode[]): RobustQueryResultAsync<{ currentCycleHash: hexstring }> { return makeRobustQueryCall(nodes, 'current-cycle-hash') }