Skip to content

Commit

Permalink
Update access handler to use finalized header cache interface object
Browse files Browse the repository at this point in the history
The emulator does not have a real finalized header cache.  We need to provide
a stub implementation instead.
  • Loading branch information
pattyshack committed May 1, 2023
1 parent 3e35791 commit 52f014f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions access/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ import (
"github.com/onflow/flow-go/consensus/hotstuff"
"github.com/onflow/flow-go/consensus/hotstuff/signature"
"github.com/onflow/flow-go/engine/common/rpc/convert"
synceng "github.com/onflow/flow-go/engine/common/synchronization"
"github.com/onflow/flow-go/model/flow"
"github.com/onflow/flow-go/module"
)

type FinalizedHeaderCache interface {
Get() *flow.Header
}

type Handler struct {
api API
chain flow.Chain
signerIndicesDecoder hotstuff.BlockSignerDecoder
finalizedHeaderCache *synceng.FinalizedHeaderCache
finalizedHeaderCache FinalizedHeaderCache
me module.Local
}

Expand All @@ -30,7 +33,7 @@ type HandlerOption func(*Handler)

var _ access.AccessAPIServer = (*Handler)(nil)

func NewHandler(api API, chain flow.Chain, finalizedHeader *synceng.FinalizedHeaderCache, me module.Local, options ...HandlerOption) *Handler {
func NewHandler(api API, chain flow.Chain, finalizedHeader FinalizedHeaderCache, me module.Local, options ...HandlerOption) *Handler {
h := &Handler{
api: api,
chain: chain,
Expand Down

0 comments on commit 52f014f

Please sign in to comment.