mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-31 15:20:15 +00:00
ae5800d47f
1068: fix potential overflow in `max_bitcoin_for_price` r=delta1 a=delta1 In testing, ASB panicked in `max_bitcoin_for_price` when the Monero balance x Bitcoin price was enough to overflow `u64`. This PR changes the function to do the piconero offset division first, and then to use `checked_mul` to return None if the calculation would overflow. This required changing the function return signature to an `Option`. Additional tests for the function were also added. MONERO_FEE was also changed from 0.000030 to 0.000016, which is still double the current median transaction fee listed at https://www.monero.how/monero-transaction-fees as of 2022-07-28. Co-authored-by: Byron Hambly <bhambly@blockstream.com> |
||
---|---|---|
.. | ||
migrations | ||
proptest-regressions/bitcoin | ||
src | ||
tests | ||
build.rs | ||
Cargo.toml | ||
sqlite_dev_setup.sh | ||
sqlx-data.json |