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

Commit

Permalink
Fix deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
jonastheis committed Dec 4, 2023
1 parent 1419993 commit ac6a993
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions pkg/protocol/protocol_warp_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,20 +210,24 @@ func (w *WarpSyncProtocol) ProcessResponse(commitmentID iotago.CommitmentID, blo
}

allBlocksNotarized.OnTrigger(func() {
// 3. Force commitment of the slot
producedCommitment, err := targetEngine.Notarization.ForceCommit(commitmentID.Slot())
if err != nil {
w.protocol.LogError("failed to force commitment", "commitmentID", commitmentID, "err", err)
// This needs to happen in a separate worker since the trigger for block notarized while the lock in
// the notarization is still held.
w.workerPool.Submit(func() {
// 3. Force commitment of the slot
producedCommitment, err := targetEngine.Notarization.ForceCommit(commitmentID.Slot())
if err != nil {
w.protocol.LogError("failed to force commitment", "commitmentID", commitmentID, "err", err)

return
}
return
}

// 4. Verify that the produced commitment is the same as the initially requested one
if producedCommitment.ID() != commitmentID {
w.protocol.LogError("commitment does not match", "expectedCommitmentID", commitmentID, "producedCommitmentID", producedCommitment.ID())
// 4. Verify that the produced commitment is the same as the initially requested one
if producedCommitment.ID() != commitmentID {
w.protocol.LogError("commitment does not match", "expectedCommitmentID", commitmentID, "producedCommitmentID", producedCommitment.ID())

return
}
return
}
})
})
}

Expand Down

0 comments on commit ac6a993

Please sign in to comment.