Skip to content

Commit 8f01d17

Browse files
authored
Don't fail validation if Jupiter provides less than 2 compute budget instructions (#121)
1 parent bbfed05 commit 8f01d17

File tree

1 file changed

+3
-3
lines changed
  • pkg/code/server/grpc/transaction/v2

1 file changed

+3
-3
lines changed

pkg/code/server/grpc/transaction/v2/swap.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,8 @@ func (s *transactionServer) validateSwap(
446446
// Part 1: Expected instructions sanity check
447447
//
448448

449-
if len(ixns.ComputeBudgetInstructions) != 0 && len(ixns.ComputeBudgetInstructions) != 2 {
450-
return newSwapValidationError("expected zero or two compute budget instructions")
449+
if len(ixns.ComputeBudgetInstructions) > 2 {
450+
return newSwapValidationError("expected at most two compute budget instructions")
451451
}
452452

453453
if ixns.TokenLedgerInstruction != nil || ixns.CleanupInstruction != nil {
@@ -458,7 +458,7 @@ func (s *transactionServer) validateSwap(
458458
// Part 2: Compute budget instructions
459459
//
460460

461-
if len(ixns.ComputeBudgetInstructions) > 0 {
461+
if len(ixns.ComputeBudgetInstructions) == 2 {
462462
if !bytes.Equal(ixns.ComputeBudgetInstructions[0].Program, compute_budget.ProgramKey) || !bytes.Equal(ixns.ComputeBudgetInstructions[1].Program, compute_budget.ProgramKey) {
463463
return newSwapValidationError("invalid ComputeBudget program key")
464464
}

0 commit comments

Comments
 (0)