Skip to content

Commit 8276ab6

Browse files
committed
OEV-679 Add separate pricing for empty txs
1 parent 81ef8e6 commit 8276ab6

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

pkg/txm/attempt_builder.go

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,30 @@ func (a *attemptBuilder) NewAgnosticBumpAttempt(ctx context.Context, lggr logger
6767
if err != nil {
6868
return nil, err
6969
}
70-
bumps := min(maxBumpThreshold, tx.AttemptCount)
71-
for range bumps {
72-
bumpedAttempt, err := a.NewBumpAttempt(ctx, lggr, tx, *attempt)
73-
if err != nil {
74-
lggr.Errorf("error bumping attempt: %v for txID: %v", err, tx.ID)
75-
return attempt, nil
70+
71+
// bump purge attempts
72+
if tx.IsPurgeable {
73+
for {
74+
// TODO: add better handling
75+
bumpedAttempt, err := a.NewBumpAttempt(ctx, lggr, tx, *attempt)
76+
if err != nil {
77+
return attempt, nil
78+
}
79+
attempt = bumpedAttempt
80+
}
81+
} else {
82+
// bump regular attempts
83+
bumps := min(maxBumpThreshold, tx.AttemptCount)
84+
for range bumps {
85+
bumpedAttempt, err := a.NewBumpAttempt(ctx, lggr, tx, *attempt)
86+
if err != nil {
87+
lggr.Errorf("error bumping attempt: %v for txID: %v", err, tx.ID)
88+
return attempt, nil
89+
}
90+
attempt = bumpedAttempt
7691
}
77-
attempt = bumpedAttempt
7892
}
93+
7994
return attempt, nil
8095
}
8196

0 commit comments

Comments
 (0)