Skip to content

Commit

Permalink
ignore blocks lying below finalized head
Browse files Browse the repository at this point in the history
  • Loading branch information
eldargab committed May 15, 2024
1 parent 1cb341d commit 5b076d9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@subsquid/substrate-data-raw",
"comment": "hot data ingestion: ignore blocks lying below finalized head",
"type": "patch"
}
],
"packageName": "@subsquid/substrate-data-raw"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@subsquid/util-internal-ingest-tools",
"comment": "hot data ingestion: ignore blocks lying below finalized head",
"type": "patch"
}
],
"packageName": "@subsquid/util-internal-ingest-tools"
}
1 change: 1 addition & 0 deletions substrate/substrate-data-raw/src/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export class RpcDataSource {
} else {
top = to.height
}
if (top < proc.getFinalizedHeight()) return
if (from > top) {
from = top
}
Expand Down
1 change: 1 addition & 0 deletions util/util-internal-ingest-tools/src/hot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class HotProcessor<B> {
if (ref.height == null) {
return !!this.chain.find(b => b.hash === ref.hash)
} else {
if (ref.height < this.chain[0].height) return true
if (ref.hash == null) return ref.height < this.getHeight()
let pos = ref.height - this.chain[0].height
return this.chain[pos]?.hash === ref.hash
Expand Down

0 comments on commit 5b076d9

Please sign in to comment.