Browse Source

Fix MAX_PRICE_DEC

2^20 is 21 bits long, _not_ 20 bits long. If we allow a bound equal to
2^20 we would need 21 bits to represent it, past our limit of 20.
fix-bad-api-calls
Lucas Soriano del Pino 3 years ago
parent
commit
d168b07065
No known key found for this signature in database GPG Key ID: EE611E973A1530E7
  1. 2
      cfd_protocol/src/interval.rs

2
cfd_protocol/src/interval.rs

@ -5,7 +5,7 @@ use std::ops::RangeInclusive;
mod digit_decomposition; mod digit_decomposition;
/// Maximum supported BTC price in whole USD. /// Maximum supported BTC price in whole USD.
const MAX_PRICE_DEC: u64 = (BASE as u64).pow(MAX_DIGITS as u32); const MAX_PRICE_DEC: u64 = (BASE as u64).pow(MAX_DIGITS as u32) - 1;
/// Maximum number of binary digits for BTC price in whole USD. /// Maximum number of binary digits for BTC price in whole USD.
const MAX_DIGITS: usize = 20; const MAX_DIGITS: usize = 20;

Loading…
Cancel
Save