Skip to content

Commit

Permalink
Implement the head offset
Browse files Browse the repository at this point in the history
Resolves #175

Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
  • Loading branch information
Kubuxu committed Jul 4, 2024
1 parent fcbc485 commit 379a46d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions host.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ func (h *gpbftHost) GetProposalForInstance(instance uint64) (*gpbft.Supplemental
if err != nil {
return nil, nil, xerrors.Errorf("getting head TS: %w", err)
}
if time.Since(headTs.Timestamp()) < h.manifest.Manifest().ECPeriod {
// less than ECPeriod since production of the head
// agreement is unlikely
headTs, err = h.client.ec.GetParent(h.runningCtx, headTs)
if err != nil {
return nil, nil, xerrors.Errorf("getting the parent of head TS: %w", err)

Check warning on line 185 in host.go

View check run for this annotation

Codecov / codecov/patch

host.go#L183-L185

Added lines #L183 - L185 were not covered by tests
}
}

collectedChain, err := h.collectChain(baseTs, headTs)
if err != nil {
Expand Down

0 comments on commit 379a46d

Please sign in to comment.