diff --git a/octane/evmengine/keeper/db.go b/octane/evmengine/keeper/db.go index a154c3c76..394c92f8b 100644 --- a/octane/evmengine/keeper/db.go +++ b/octane/evmengine/keeper/db.go @@ -6,6 +6,7 @@ import ( "github.com/omni-network/omni/lib/cast" "github.com/omni-network/omni/lib/errors" + "github.com/omni-network/omni/lib/umath" "github.com/ethereum/go-ethereum/beacon/engine" "github.com/ethereum/go-ethereum/common" @@ -132,12 +133,18 @@ func (k *Keeper) EligibleWithdrawals(ctx context.Context) ([]*Withdrawal, error) return nil, errors.Wrap(err, "get withdrawal") } + if val.GetCreatedHeight() >= uint64(height) { + // Withdrawals created in this block are not eligible break + break + } + if val.GetCreatedHeight() < uint64(height) { withdrawals = append(withdrawals, val) + } - if uint64(len(withdrawals)) == k.maxWithdrawalsPerBlock { - break - } + if umath.Len(withdrawals) == k.maxWithdrawalsPerBlock { + // Reached the max number of withdrawals + break } }