Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: defer miner start until after processing TX #239

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions internal/indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ func (i *Indexer) handleEventTransaction(evt event.Event) error {
)
}
// Process produced UTxOs
startMiner := false
for _, utxo := range eventTx.Transaction.Produced() {
outputAddress := utxo.Output.Address().String()
// Ignore outputs to addresses that we don't care about
Expand Down Expand Up @@ -360,10 +361,7 @@ func (i *Indexer) handleEventTransaction(evt event.Event) error {
}

if i.tipReached {
// TODO: defer starting miner until after processing all TX outputs
// Restart miners for new datum
miner.GetManager().Stop()
miner.GetManager().Start(i.lastBlockData)
startMiner = true
}
}
}
Expand All @@ -376,6 +374,11 @@ func (i *Indexer) handleEventTransaction(evt event.Event) error {
)
}
}
// (Re)start miner if we got a new datum
if startMiner {
miner.GetManager().Stop()
miner.GetManager().Start(i.lastBlockData)
}
return nil
}

Expand Down