Skip to content

Commit

Permalink
fix: fixed case when tx hash is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikelle committed Jul 10, 2024
1 parent 3946648 commit 5faa6ba
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions p2p/pkg/preconfirmation/tracker/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,10 @@ func (t *Tracker) handleNewL1Block(
settled := 0
for _, commitment := range commitments {
if commitment.CommitmentIndex == nil {
failedCommitments = append(failedCommitments, commitment.TxnHash)
t.logger.Debug("commitment index not found", "commitment", commitment)
if commitment.TxnHash != (common.Hash{}) {
failedCommitments = append(failedCommitments, commitment.TxnHash)
}
continue
}
if common.BytesToAddress(commitment.ProviderAddress).Cmp(newL1Block.Winner) != 0 {
Expand Down Expand Up @@ -367,20 +370,20 @@ func (t *Tracker) handleNewL1Block(
t.metrics.totalOpenedCommitments.Add(float64(settled))
t.metrics.blockCommitmentProcessDuration.Set(float64(openDuration))

if len(failedCommitments) > 0 {
t.logger.Info("processing failed commitments", "count", len(failedCommitments))
receipts, err := t.receiptGetter.BatchReceipts(ctx, failedCommitments)
if err != nil {
t.logger.Warn("failed to get receipts for failed commitments", "error", err)
return nil
}
for i, receipt := range receipts {
t.logger.Debug("receipt for failed commitment",
"txHash", failedCommitments[i],
"error", receipt.Err,
)
}
}
// if len(failedCommitments) > 0 {
// t.logger.Info("processing failed commitments", "count", len(failedCommitments))
// receipts, err := t.receiptGetter.BatchReceipts(ctx, failedCommitments)
// if err != nil {
// t.logger.Warn("failed to get receipts for failed commitments", "error", err)
// return nil
// }
// for i, receipt := range receipts {
// t.logger.Debug("receipt for failed commitment",
// "txHash", failedCommitments[i],
// "error", receipt.Err,
// )
// }
// }

return nil
}
Expand Down

0 comments on commit 5faa6ba

Please sign in to comment.