-
Notifications
You must be signed in to change notification settings - Fork 499
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
exp/orderbook: Allow updates to the order book graph which span multi…
…ple ledgers (#2649) Before #2639 we were updating the order book graph via ingestion on every single ledger. The order book graph was implemented with the expectation that you must apply changes for every single ledger and no ledgers should be skipped. However, we can no longer maintain that invariant because now we are applying updates to the order book graph via the OrderBookStream. The OrderBookStream periodically polls for new / updated offers from the Horizon DB. It is possible that ingestion has advanced by more than one ledger since the last time OrderBookStream updated the order book graph. Therefore we must relax the restrictions for how updates are applied to an order book graph. We still require ledgers to be strictly increasing when applying updates to an order book graph. However, now we allow updates to span multiple ledgers. We also allow you to remove an offer which is not present in the order book. Consider the case where you apply updates from ledger x. Let's say the next time we update the order book graph ingestion has already advanced to x+2. It is possible that an offer was created in ledger x+1 and in ledger x+2 we are removing the offer. However, our graph was last updated at ledger x, so when we try to remove the offer which was created in ledger x+1 we will panic unless we deliberately skip over offers which are not present in the order book.
- Loading branch information
Showing
6 changed files
with
77 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters