From bd8a3e15b963525d92c2183cdc7237e5754f7620 Mon Sep 17 00:00:00 2001 From: Piotr Macek <4007944+piotrm50@users.noreply.github.com> Date: Tue, 21 Nov 2023 15:40:10 +0100 Subject: [PATCH] Do not fan-out event to TipSelection and Notarization, but call them sequentially. --- pkg/protocol/engine/engine.go | 1 + pkg/protocol/engine/tipselection/v1/provider.go | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/protocol/engine/engine.go b/pkg/protocol/engine/engine.go index f50224882..e202d9a33 100644 --- a/pkg/protocol/engine/engine.go +++ b/pkg/protocol/engine/engine.go @@ -437,6 +437,7 @@ func (e *Engine) acceptanceHandler() { e.Ledger.TrackBlock(block) e.SybilProtection.TrackBlock(block) e.UpgradeOrchestrator.TrackValidationBlock(block) + e.TipSelection.SetAcceptanceTime(block.IssuingTime()) e.Events.AcceptedBlockProcessed.Trigger(block) }, event.WithWorkerPool(wp)) diff --git a/pkg/protocol/engine/tipselection/v1/provider.go b/pkg/protocol/engine/tipselection/v1/provider.go index f26180628..eb7dbb6ae 100644 --- a/pkg/protocol/engine/tipselection/v1/provider.go +++ b/pkg/protocol/engine/tipselection/v1/provider.go @@ -8,7 +8,6 @@ import ( "github.com/iotaledger/hive.go/runtime/module" "github.com/iotaledger/hive.go/runtime/options" "github.com/iotaledger/iota-core/pkg/protocol/engine" - "github.com/iotaledger/iota-core/pkg/protocol/engine/blocks" "github.com/iotaledger/iota-core/pkg/protocol/engine/tipmanager" "github.com/iotaledger/iota-core/pkg/protocol/engine/tipselection" iotago "github.com/iotaledger/iota.go/v4" @@ -23,10 +22,6 @@ func NewProvider(opts ...options.Option[TipSelection]) module.Provider[*engine.E // wait for submodules to be constructed (so all of their properties are available) module.OnAllConstructed(func() { t.Construct(e.TipManager, e.Ledger.ConflictDAG(), e.Ledger.MemPool().TransactionMetadata, func() iotago.BlockIDs { return lo.Keys(e.EvictionState.ActiveRootBlocks()) }, DynamicLivenessThreshold(e.SybilProtection.SeatManager().OnlineCommittee().Size)) - - e.Events.AcceptedBlockProcessed.Hook(func(block *blocks.Block) { - t.SetAcceptanceTime(block.IssuingTime()) - }) }, e.TipManager, e.Ledger, e.SybilProtection) })