github.com/koko1123/flow-go-1@v0.29.6/consensus/integration/counter_test.go (about)

     1  package integration_test
     2  
     3  import (
     4  	"github.com/koko1123/flow-go-1/consensus/hotstuff/model"
     5  	"github.com/koko1123/flow-go-1/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  }