github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/consensus/integration/counter_test.go (about)

     1  package integration_test
     2  
     3  import (
     4  	"github.com/onflow/flow-go/consensus/hotstuff/model"
     5  	"github.com/onflow/flow-go/consensus/hotstuff/notifications"
     6  )
     7  
     8  type CounterConsumer struct {
     9  	notifications.NoopConsumer
    10  	total     uint
    11  	finalized func(uint)
    12  }
    13  
    14  func (c *CounterConsumer) OnFinalizedBlock(block *model.Block) {
    15  	c.total++
    16  
    17  	// notify stopper of total finalized
    18  	c.finalized(c.total)
    19  }