Skip to content

Commit

Permalink
use commit height in GetBlockInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
renaynay committed Jan 10, 2022
1 parent b7f82c2 commit e7bd7bf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ func (f *BlockFetcher) GetBlockInfo(ctx context.Context, height *int64) (*types.
return nil, nil, fmt.Errorf("core/fetcher: getting commit: %w", err)
}

valSet, err := f.ValidatorSet(ctx, height)
// If a nil `height` is given as a parameter, there is a chance
// that a new block could be produced between getting the latest
// commit and getting the latest validator set. Therefore, it is
// best to get the validator set at the latest commit's height to
// prevent this potential inconsistency.
valSet, err := f.ValidatorSet(ctx, &commit.Height)
if err != nil {
return nil, nil, fmt.Errorf("core/fetcher: getting validator set: %w", err)
}
Expand Down

0 comments on commit e7bd7bf

Please sign in to comment.