Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions services/horizon/internal/actions/orderbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import (
"net/http"
"slices"

protocol "github.com/stellar/go/protocols/horizon"
"github.com/stellar/go/services/horizon/internal/context"
Expand All @@ -23,20 +24,6 @@
protocol.OrderBookSummary
}

func priceLevelsEqual(a, b []protocol.PriceLevel) bool {
if len(a) != len(b) {
return false
}

for i := range a {
if a[i] != b[i] {
return false
}
}

return true
}

// Equals returns true if the OrderBookResponse is equal to `other`
func (o OrderBookResponse) Equals(other StreamableObjectResponse) bool {
otherOrderBook, ok := other.(OrderBookResponse)
Expand All @@ -45,8 +32,8 @@
}
return otherOrderBook.Selling == o.Selling &&
otherOrderBook.Buying == o.Buying &&
priceLevelsEqual(otherOrderBook.Bids, o.Bids) &&
priceLevelsEqual(otherOrderBook.Asks, o.Asks)
slices.Equal(otherOrderBook.Bids, o.Bids) &&

Check failure on line 35 in services/horizon/internal/actions/orderbook.go

View workflow job for this annotation

GitHub Actions / golangci

otherOrderBook.Bids undefined (type OrderBookResponse has no field or method Bids) (typecheck)
slices.Equal(otherOrderBook.Asks, o.Asks)

Check failure on line 36 in services/horizon/internal/actions/orderbook.go

View workflow job for this annotation

GitHub Actions / golangci

otherOrderBook.Asks undefined (type OrderBookResponse has no field or method Asks) (typecheck)
}

var invalidOrderBook = problem.P{
Expand Down
Loading