Skip to content

Commit

Permalink
skip filling chain on duplicate sethead
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Sep 5, 2023
1 parent db353e2 commit 7ffc137
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/client/src/sync/skeleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export class Skeleton extends MetaDBManager {
const mayBeDupBlock = await this.getBlock(number)
if (mayBeDupBlock !== undefined && equalsBytes(mayBeDupBlock.header.hash(), head.hash())) {
this.config.logger.debug(
`Skeleton duplicate announcement tail=${lastchain.tail} head=${
`Skeleton duplicate ${force ? 'setHead' : 'announcement'} tail=${lastchain.tail} head=${
lastchain.head
} number=${number} hash=${short(head.hash())}`
)
Expand Down Expand Up @@ -363,7 +363,12 @@ export class Skeleton extends MetaDBManager {
if (force || init) {
await this.writeSyncStatus()
}
if (force && this.status.linked) {
if (
(force &&
this.status.linked &&
head.header.number > this.status.progress.subchains[0]?.head) ??
BigInt(0)
) {
void this.fillCanonicalChain()
}
// Earlier we were throwing on reorg, essentially for the purposes for killing the reverse fetcher
Expand Down

0 comments on commit 7ffc137

Please sign in to comment.