Skip to content

Commit

Permalink
fix(coordinator): Remove insane compile_error!
Browse files Browse the repository at this point in the history
I was trying to fail at compile time based on a runtime value (the
settings). This is dumb.

We now fail at runtime if we try to use a fixed index price in release
mode. Production always runs on release, so this exists to prevent
using a fixed index price in production.

Obviously, release does not always equal production, but using the
real index price from BitMEX is fine in most scenarios (except for
the e2e tests and some instances of local testing).
  • Loading branch information
luckysori committed Jun 5, 2024
1 parent dffd492 commit 93cbfb0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions coordinator/src/funding_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use diesel::PgConnection;
use rust_decimal::prelude::ToPrimitive;
use rust_decimal::Decimal;
use rust_decimal::RoundingStrategy;
use rust_decimal_macros::dec;
use std::time::Duration;
use time::ext::NumericalDuration;
use time::format_description;
Expand Down Expand Up @@ -144,9 +143,10 @@ fn generate_funding_fee_events(
})?,
IndexPriceSource::Test => {
#[cfg(not(debug_assertions))]
compile_error!("Cannot use a test index price in release mode");
panic!("Cannot use a test index price in release mode");

dec!(50_000)
#[cfg(debug_assertions)]
rust_decimal_macros::dec!(50_000)
}
};

Expand Down

0 comments on commit 93cbfb0

Please sign in to comment.