Skip to content

Commit

Permalink
Merge pull request #10 from gobicycle/develop
Browse files Browse the repository at this point in the history
Node lag fix
  • Loading branch information
gobicycle authored Sep 26, 2023
2 parents 67d119b + 6cb4805 commit a8d8560
Show file tree
Hide file tree
Showing 2 changed files with 197 additions and 217 deletions.
8 changes: 7 additions & 1 deletion blockchain/shard_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ func (s *ShardTracker) getShardBlocksRecursively(i *ton.BlockIDExt, batch []core
return batch, false, nil
}

// compare seqno with filtered shard block
// handle the case when a node may reference an old block
if s.lastKnownShardBlock.SeqNo > i.SeqNo {
return []core.ShardBlockHeader{}, false, nil
}

seqnoDiff := int(i.SeqNo - s.lastKnownShardBlock.SeqNo)
if seqnoDiff > s.infoStep {
if s.infoCounter%s.infoStep == 0 {
Expand Down Expand Up @@ -197,7 +203,7 @@ func filterByShard(headers []*ton.BlockIDExt, shard byte) *ton.BlockIDExt {
func convertBlockToShardHeader(block *tlb.Block, info *ton.BlockIDExt, shard byte) (core.ShardBlockHeader, error) {
parents, err := block.BlockInfo.GetParentBlocks()
if err != nil {
return core.ShardBlockHeader{}, nil
return core.ShardBlockHeader{}, err
}
parent := filterByShard(parents, shard)
return core.ShardBlockHeader{
Expand Down
Loading

0 comments on commit a8d8560

Please sign in to comment.