Skip to content

Commit

Permalink
refactor(coin_selection)!: use Amount and SignedAmount for API and in…
Browse files Browse the repository at this point in the history
…ternally

Using named types make the API and internal code easier to read and reason
about since it makes it clear that the values are bitcoin amounts. Also to
create these types the units (ie .from_sat()) must be specified.

Using Amount and SignedAmount also makes internal code safer against overflow
errors. In particular because these types will panic if an amount overflow
occurs. Using u64/i64 on the otherhand can silently rollover. See:
https://doc.rust-lang.org/book/ch03-02-data-types.html#integer-overflow
  • Loading branch information
notmandatory committed Dec 11, 2024
1 parent 955593c commit 58a8435
Show file tree
Hide file tree
Showing 3 changed files with 220 additions and 187 deletions.
Loading

0 comments on commit 58a8435

Please sign in to comment.