dfinity / exchange-rate-canister

The exchange rate canister (XRC) makes use of the HTTP requests feature to provide exchange rates as a service to the IC.
Apache License 2.0
37 stars 10 forks source link

refactor: Rate limiting guard should track the calculated HTTP requests and add `is_available` to exchanges and forex sources to clean up feature flag check. #134

Closed dfinity-ryancroote closed 1 year ago

dfinity-ryancroote commented 1 year ago

This PR refactors the following two items:

  1. The rate limiting guard now takes the number of HTTP requests needed instead of the number of rates needed. This moves the calculation out. This also fixes a bug when IPv4 support is not available causing more requests to be reserved than required.

  2. It adds an is_available to Exchange and Forex to make it easier to determine if the exchange or forex can be used as the IPv4 feature flag was used to compile the canister or they support IPv6 out-of-the-box.