Skip to content

Commit

Permalink
Fix: gas value check only for non-in-flight requests
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi committed Apr 13, 2024
1 parent 4f34139 commit c2e83c0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion services/rfq/relayer/service/statushandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ func (r *Relayer) gasMiddleware(next func(ctx context.Context, span trace.Span,
}

// on destination, we need to check transactor.Value as well if we are dealing with ETH
// However, all requests with statuses CommittedPending, CommittedConfirmed and RelayStarted are considered
// in-flight and their respective amounts are already deducted from the inventory: see Manager.GetCommittableBalances().
// Therefore, we only need to check the gas value for requests with all the other statuses.
isInFlight := req.Status == reldb.CommittedPending || req.Status == reldb.CommittedConfirmed || req.Status == reldb.RelayStarted
var destGasValue *big.Int
if req.Transaction.DestToken == chain.EthAddress {
if req.Transaction.DestToken == chain.EthAddress && !isInFlight {
destGasValue = req.Transaction.DestAmount
span.SetAttributes(attribute.String("dest_gas_value", destGasValue.String()))
}
Expand Down

0 comments on commit c2e83c0

Please sign in to comment.