Skip to content

Commit

Permalink
fix(TransformItx): empty revertSource + error before skipping
Browse files Browse the repository at this point in the history
  • Loading branch information
Tangui-Bitfly committed Jan 22, 2025
1 parent d95173f commit 9d133f3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions db/bigtable_eth1.go
Original file line number Diff line number Diff line change
Expand Up @@ -1310,22 +1310,23 @@ func (bigtable *Bigtable) TransformItx(blk *types.Eth1Block, cache *freecache.Ca
}
jReversed := reversePaddedIndex(j, ITX_PER_TX_LIMIT)

if itx.Path == "[]" || bytes.Equal(itx.Value, []byte{0x0}) { // skip top level and empty calls
continue
}

// check for error before skipping, otherwise we loose track of cascading reverts
var reverted bool
if itx.ErrorMsg != "" {
reverted = true
// only save the highest root revert
if !strings.HasPrefix(itx.Path, revertSource) {
if revertSource == "" || !strings.HasPrefix(itx.Path, revertSource) {
revertSource = strings.TrimSuffix(itx.Path, "]")
}
}
if strings.HasPrefix(itx.Path, revertSource) {
if revertSource != "" && strings.HasPrefix(itx.Path, revertSource) {
reverted = true
}

if itx.Path == "[]" || bytes.Equal(itx.Value, []byte{0x0}) { // skip top level and empty calls
continue
}

key := fmt.Sprintf("%s:ITX:%x:%s", bigtable.chainId, tx.GetHash(), jReversed)
indexedItx := &types.Eth1InternalTransactionIndexed{
ParentHash: tx.GetHash(),
Expand Down

0 comments on commit 9d133f3

Please sign in to comment.