Skip to content

Commit

Permalink
bug: Make sure blockCount is not longer than the current chain length (
Browse files Browse the repository at this point in the history
…#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.
  • Loading branch information
mattheworris authored Aug 7, 2024
1 parent 933f46d commit 669e73a
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export class CrawlerService extends BaseConsumer {
job.data.startBlock = startBlock;
this.logger.debug(`No starting block specified; starting from end of chain at block ${startBlock}`);
}
// Make sure blockCount is not longer than the current chain length
if (job.data.blockCount >= startBlock) {
job.data.blockCount = startBlock;
}
let blockList = new Array(job.data.blockCount).fill(0).map((_v, index) => startBlock - index);
blockList.reverse();

Expand Down

0 comments on commit 669e73a

Please sign in to comment.