@@ -191,7 +191,7 @@ func (b *Builder) BuildOn(parentID flow.Identifier, setter func(*flow.HeaderBody
191191 // STEP 2: build a payload of valid transactions, while at the same
192192 // time figuring out the correct reference block ID for the collection.
193193 span , _ = b .tracer .StartSpanFromContext (ctx , trace .COLBuildOnCreatePayload )
194- payload , err := b .buildPayload (buildCtx )
194+ payload , priorityTransactionsCount , err := b .buildPayload (buildCtx )
195195 span .End ()
196196 if err != nil {
197197 return nil , fmt .Errorf ("could not build payload: %w" , err )
@@ -216,6 +216,8 @@ func (b *Builder) BuildOn(parentID flow.Identifier, setter func(*flow.HeaderBody
216216 return nil , fmt .Errorf ("could not build cluster block: %w" , err )
217217 }
218218
219+ b .metrics .ClusterBlockCreated (block , priorityTransactionsCount )
220+
219221 blockProposal , err := cluster .NewProposal (
220222 cluster.UntrustedProposal {
221223 Block : * block ,
@@ -404,7 +406,7 @@ func (b *Builder) populateFinalizedAncestryLookup(lctx lockctx.Proof, ctx *block
404406// buildPayload constructs a valid payload based on transactions available in the mempool.
405407// If the mempool is empty, an empty payload will be returned.
406408// No errors are expected during normal operation.
407- func (b * Builder ) buildPayload (buildCtx * blockBuildContext ) (* cluster.Payload , error ) {
409+ func (b * Builder ) buildPayload (buildCtx * blockBuildContext ) (* cluster.Payload , uint , error ) {
408410 lookup := buildCtx .lookup
409411 limiter := buildCtx .limiter
410412 config := buildCtx .config
@@ -469,7 +471,7 @@ func (b *Builder) buildPayload(buildCtx *blockBuildContext) (*cluster.Payload, e
469471 continue // in case we are configured with liberal transaction ingest rules
470472 }
471473 if err != nil {
472- return nil , fmt .Errorf ("could not retrieve reference header: %w" , err )
474+ return nil , 0 , fmt .Errorf ("could not retrieve reference header: %w" , err )
473475 }
474476
475477 // disallow un-finalized reference blocks, and reference blocks beyond the cluster's operating epoch
@@ -480,7 +482,7 @@ func (b *Builder) buildPayload(buildCtx *blockBuildContext) (*cluster.Payload, e
480482 // make sure the reference block is finalized and not orphaned
481483 blockIDFinalizedAtRefHeight , err := b .mainHeaders .BlockIDByHeight (refHeader .Height )
482484 if err != nil {
483- return nil , fmt .Errorf ("could not check that reference block (id=%x) for transaction (id=%x) is finalized: %w" , tx .ReferenceBlockID , txID , err )
485+ return nil , 0 , fmt .Errorf ("could not check that reference block (id=%x) for transaction (id=%x) is finalized: %w" , tx .ReferenceBlockID , txID , err )
484486 }
485487 if blockIDFinalizedAtRefHeight != tx .ReferenceBlockID {
486488 // the transaction references an orphaned block - it will never be valid
@@ -544,7 +546,7 @@ func (b *Builder) buildPayload(buildCtx *blockBuildContext) (*cluster.Payload, e
544546 // build the payload from the transactions
545547 collection , err := flow .NewCollection (flow.UntrustedCollection {Transactions : transactions })
546548 if err != nil {
547- return nil , fmt .Errorf ("could not build the collection from the transactions: %w" , err )
549+ return nil , 0 , fmt .Errorf ("could not build the collection from the transactions: %w" , err )
548550 }
549551
550552 payload , err := cluster .NewPayload (
@@ -554,9 +556,9 @@ func (b *Builder) buildPayload(buildCtx *blockBuildContext) (*cluster.Payload, e
554556 },
555557 )
556558 if err != nil {
557- return nil , fmt .Errorf ("could not build a payload: %w" , err )
559+ return nil , 0 , fmt .Errorf ("could not build a payload: %w" , err )
558560 }
559- return payload , nil
561+ return payload , uint ( len ( priorityTransactions )), nil
560562}
561563
562564// buildHeader constructs the header for the cluster block being built.
0 commit comments