Skip to content

Commit 08a708e

Browse files
committed
fix: early return when first-not-match
1 parent 5b20d64 commit 08a708e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • packages/neuron-wallet/src/services/sync

packages/neuron-wallet/src/services/sync/queue.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ export default class Queue {
7373
const blockHeaders: BlockHeader[] = blocks.map(block => block.header)
7474

7575
// 2. check blockHeaders
76-
await this.checkBlockHeader(blockHeaders)
76+
const checkResult = await this.checkBlockHeader(blockHeaders)
77+
78+
if (checkResult.type === 'first-not-match') {
79+
return
80+
}
7781

7882
// 3. check and save
7983
await this.getBlocksService.checkAndSave(blocks, this.lockHashes)
@@ -103,6 +107,8 @@ export default class Queue {
103107
throw new Error('chain forked')
104108
}
105109
}
110+
111+
return checkResult
106112
}
107113

108114
public push = (blockNumbers: string[]): void => {

0 commit comments

Comments
 (0)