Skip to content

Commit

Permalink
Fix panic when feeder returns mismatched number of txns and receipts
Browse files Browse the repository at this point in the history
  • Loading branch information
omerfirmak authored and wojciechos committed Oct 4, 2023
1 parent 0bfac9d commit 12f9a19
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions adapters/feeder2core/feeder2core.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ func AdaptBlock(response *feeder.Block) (*core.Block, error) {
}

txns := make([]core.Transaction, len(response.Transactions))
receipts := make([]*core.TransactionReceipt, len(response.Receipts))
eventCount := uint64(0)
for i, txn := range response.Transactions {
var err error
txns[i], err = AdaptTransaction(txn)
if err != nil {
return nil, err
}
receipts[i] = AdaptTransactionReceipt(response.Receipts[i])
eventCount += uint64(len(response.Receipts[i].Events))
}

receipts := make([]*core.TransactionReceipt, len(response.Receipts))
eventCount := uint64(0)
for i, receipt := range response.Receipts {
receipts[i] = AdaptTransactionReceipt(receipt)
eventCount += uint64(len(receipt.Events))
}

return &core.Block{
Expand Down

0 comments on commit 12f9a19

Please sign in to comment.