From 9f55bdb5c5c71adb2ffe179246ff415cbae1c757 Mon Sep 17 00:00:00 2001 From: "Leo Zhang (zhangchiqing)" Date: Fri, 31 Jan 2025 16:15:10 -0800 Subject: [PATCH] skip duplicates --- state/protocol/badger/mutator.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/state/protocol/badger/mutator.go b/state/protocol/badger/mutator.go index 1dd1f41134d..872293bce01 100644 --- a/state/protocol/badger/mutator.go +++ b/state/protocol/badger/mutator.go @@ -366,7 +366,7 @@ func (m *FollowerState) headerExtend(ctx context.Context, candidate *flow.Block, } } else { // parent is a block that has been received and certified by a QC. - err := transaction.WithTx(operation.IndexCertifiedBlockByView(parent.View, qc.BlockID))(tx) + err := transaction.WithTx(operation.SkipDuplicates(operation.IndexCertifiedBlockByView(parent.View, qc.BlockID)))(tx) if err != nil { return fmt.Errorf("could not index certified block: %w", err) } @@ -397,7 +397,7 @@ func (m *FollowerState) headerExtend(ctx context.Context, candidate *flow.Block, } // candidate is a block that has been received and certified by a QC - err := transaction.WithTx(operation.IndexCertifiedBlockByView(candidate.Header.View, blockID))(tx) + err := transaction.WithTx(operation.SkipDuplicates(operation.IndexCertifiedBlockByView(candidate.Header.View, blockID)))(tx) if err != nil { return fmt.Errorf("could not index certified block: %w", err) }