diff --git a/ingest/offers/main.go b/ingest/offers/main.go index 0eb4ab25ca..e47de6f003 100644 --- a/ingest/offers/main.go +++ b/ingest/offers/main.go @@ -16,16 +16,14 @@ const ( // Base struct with common fields for all offer events. type OfferEventData struct { - SellerId string - OfferID int64 - - BuyingAsset xdr.Asset - SellingAsset xdr.Asset - - RemainingAmount int64 // Remaining amount that still needs to be filled for this offer - PriceN int32 - PriceD int32 - + SellerId string + OfferID int64 + BuyingAsset xdr.Asset + SellingAsset xdr.Asset + RemainingAmount int64 // Remaining amount that still needs to be filled for this offer + PriceN int32 + PriceD int32 + Flags int32 IsPassive bool LastModifiedLedger uint32 Sponsor null.String @@ -108,7 +106,8 @@ func populateOfferData(e *xdr.LedgerEntry) OfferEventData { RemainingAmount: int64(offer.Amount), PriceN: int32(offer.Price.N), PriceD: int32(offer.Price.D), - IsPassive: (offer.Flags & 0x1) != 0, + Flags: int32(offer.Flags), + IsPassive: int32(offer.Flags) == int32(xdr.OfferEntryFlagsPassiveFlag), LastModifiedLedger: uint32(e.LastModifiedLedgerSeq), Sponsor: utils.LedgerEntrySponsorToNullString(*e), } diff --git a/services/horizon/internal/ingest/processors/offers_processor.go b/services/horizon/internal/ingest/processors/offers_processor.go index 2034f3be3a..30344473bd 100644 --- a/services/horizon/internal/ingest/processors/offers_processor.go +++ b/services/horizon/internal/ingest/processors/offers_processor.go @@ -70,24 +70,19 @@ func (p *OffersProcessor) ProcessChange(ctx context.Context, change ingest.Chang } -func (p *OffersProcessor) offerEventToRow(event offers.OfferEventData) history.Offer { - flags := int32(0) - if event.IsPassive { - flags = 1 - } - +func (p *OffersProcessor) offerEventToRow(e offers.OfferEventData) history.Offer { return history.Offer{ - SellerID: event.SellerId, - OfferID: event.OfferID, - SellingAsset: event.SellingAsset, - BuyingAsset: event.BuyingAsset, - Amount: event.RemainingAmount, - Pricen: event.PriceN, - Priced: event.PriceD, - Price: float64(event.PriceN) / float64(event.PriceD), - Flags: flags, - LastModifiedLedger: event.LastModifiedLedger, - Sponsor: event.Sponsor, + SellerID: e.SellerId, + OfferID: e.OfferID, + SellingAsset: e.SellingAsset, + BuyingAsset: e.BuyingAsset, + Amount: e.RemainingAmount, + Pricen: e.PriceN, + Priced: e.PriceD, + Price: float64(e.PriceN) / float64(e.PriceD), + Flags: e.Flags, + LastModifiedLedger: e.LastModifiedLedger, + Sponsor: e.Sponsor, } }