Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit 5a02d79

Browse files
committed
Do not propagate pre-confirmation over epoch boundaries
1 parent 11db507 commit 5a02d79

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/witness_weight.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ func (g *Gadget) TrackWitnessWeight(votingBlock *blocks.Block) {
1616
return
1717
}
1818

19+
votingBlockEpoch := votingBlock.ProtocolBlock().API.TimeProvider().EpochFromSlot(votingBlock.ID().Slot())
20+
1921
var toPreAccept []*blocks.Block
2022
toPreAcceptByID := ds.NewSet[iotago.BlockID]()
2123

@@ -32,7 +34,8 @@ func (g *Gadget) TrackWitnessWeight(votingBlock *blocks.Block) {
3234
propagateFurther = true
3335
}
3436

35-
if !block.IsPreConfirmed() && (shouldPreConfirm || anyChildInSet(block, toPreConfirmByID)) {
37+
blockEpoch := block.ProtocolBlock().API.TimeProvider().EpochFromSlot(block.ID().Slot())
38+
if !block.IsPreConfirmed() && votingBlockEpoch == blockEpoch && (shouldPreConfirm || anyChildInSet(block, toPreConfirmByID)) {
3639
toPreConfirm = append([]*blocks.Block{block}, toPreConfirm...)
3740
toPreConfirmByID.Add(block.ID())
3841
propagateFurther = true

0 commit comments

Comments
 (0)