Skip to content

Commit 669e73a

Browse files
authored
bug: Make sure blockCount is not longer than the current chain length (#348)
# Problem When running a local development frequency node, the chain length will be quite short. This results in trying to scan a blocklist that includes negative numbers, which causes the scan to fail and no previous content to be found. # Solution ```javascript // Make sure blockCount is not longer than the current chain length if (job.data.blockCount >= startBlock) { job.data.blockCount = startBlock; } ``` ## Steps to Verify: 1. Run SAT with a local frequency node and verify that the initial scan completes correctly.
1 parent 933f46d commit 669e73a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

services/content-watcher/libs/common/src/crawler/crawler.service.ts

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ export class CrawlerService extends BaseConsumer {
3737
job.data.startBlock = startBlock;
3838
this.logger.debug(`No starting block specified; starting from end of chain at block ${startBlock}`);
3939
}
40+
// Make sure blockCount is not longer than the current chain length
41+
if (job.data.blockCount >= startBlock) {
42+
job.data.blockCount = startBlock;
43+
}
4044
let blockList = new Array(job.data.blockCount).fill(0).map((_v, index) => startBlock - index);
4145
blockList.reverse();
4246

0 commit comments

Comments
 (0)