Skip to content

Commit dfa2f1e

Browse files
committed
fix: sync stopped in indexer and normal mode
1 parent c3bbc73 commit dfa2f1e

4 files changed

Lines changed: 17 additions & 9 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ export default class IndexerQueue {
177177
txPoint &&
178178
(BigInt(txPoint.blockNumber) >= startBlockNumber || this.tipBlockNumber - BigInt(txPoint.blockNumber) < 1000)
179179
) {
180+
logger.debug('indexer fetched tx:', type, txPoint.txHash)
181+
180182
const transactionWithStatus = await this.getBlocksService.getTransaction(txPoint.txHash)
181183
const ckbTransaction: CKBComponents.Transaction = transactionWithStatus.transaction
182184
const transaction: Transaction = TypeConvert.toTransaction(ckbTransaction)

packages/neuron-wallet/src/services/sync/check-and-save/index.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ export default class CheckAndSave {
1212

1313
public process = async (): Promise<boolean[]> => {
1414
const txs = this.block.transactions
15-
return Promise.all(
16-
txs.map(async tx => {
17-
const checkTx = new CheckTx(tx)
18-
return checkTx.checkAndSave(this.lockHashes)
19-
})
20-
)
15+
let result: boolean[] = []
16+
for (const tx of txs) {
17+
const checkTx = new CheckTx(tx)
18+
const checkResult = await checkTx.checkAndSave(this.lockHashes)
19+
result.push(checkResult)
20+
}
21+
return result
2122
}
2223
}

packages/neuron-wallet/src/services/sync/get-blocks.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@ export default class GetBlocks {
3434
}
3535

3636
public checkAndSave = async (blocks: Block[], lockHashes: string[]) => {
37-
return Utils.mapSeries(blocks, async (block: Block) => {
37+
let checkResult: boolean[][] = []
38+
for (const block of blocks) {
3839
const checkAndSave = new CheckAndSave(block, lockHashes)
39-
return checkAndSave.process()
40-
})
40+
const result = await checkAndSave.process()
41+
checkResult.push(result)
42+
}
43+
return checkResult
4144
}
4245

4346
public retryGetBlock = async (num: string): Promise<Block> => {

packages/neuron-wallet/src/services/tx/transaction-persistor.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ export class TransactionPersistor {
179179
} finally {
180180
await queryRunner.release()
181181
}
182+
tx.inputs = inputs
183+
tx.outputs = outputs
182184
return tx
183185
}
184186

0 commit comments

Comments
 (0)