diff --git a/engine/execution/ingestion/throttle.go b/engine/execution/ingestion/throttle.go index b98157dbda2..16ca08797e9 100644 --- a/engine/execution/ingestion/throttle.go +++ b/engine/execution/ingestion/throttle.go @@ -42,10 +42,6 @@ type BlockThrottle struct { headers storage.Headers } -type BlockHandler interface { - OnBlock(block *flow.Header) error -} - func NewBlockThrottle( log zerolog.Logger, state protocol.State, @@ -108,7 +104,7 @@ func (c *BlockThrottle) Init(processables chan<- flow.Identifier) error { return nil } -func (c *BlockThrottle) OnBlockExecuted(executed uint64, _ flow.Identifier) error { +func (c *BlockThrottle) OnBlockExecuted(_ flow.Identifier, executed uint64) error { c.mu.Lock() defer c.mu.Unlock() @@ -148,21 +144,22 @@ func (c *BlockThrottle) OnBlockExecuted(executed uint64, _ flow.Identifier) erro return nil } -func (c *BlockThrottle) BlockProcessable(block *flow.Header, qc *flow.QuorumCertificate) { +func (c *BlockThrottle) OnBlock(blockID flow.Identifier) error { c.mu.Lock() defer c.mu.Unlock() if !c.inited { - return + return fmt.Errorf("throttle not inited") } // ignore the block if has not caught up. if !c.caughtUp() { - return + return nil } // if has caught up, then process the block - c.processables <- qc.BlockID + c.processables <- blockID + return nil } func (c *BlockThrottle) OnBlockFinalized(lastFinalized *flow.Header) {