-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use bitcoin::Amount
everywhere
#1432
Comments
I still like the idea of using |
I might be biased, but I think that using It internally adopts
I understand that on both scenarios we are reinventing the wheel, and even at a loss of all the conversions between denominations and error treatment already implemented on |
Using edit: I think we can use |
It was decided initially to only include
bitcoin::Amount
at the API boundary. No doubt this makes for a better UX. Would it be worth replacing all satoshi amounts represented internally asu64
with theAmount
type?One concern would be: why introduce an abstraction over the denomination when sats are already the standard used throughout the library, but it's possible this fear is overblown.
Alternatives:
pub type Satoshis = u64;
However this serves no real purpose at the type level other than to enhance readability.Amount
. The problem with this is re-inventing the wheel when theAmount
type already exists.So with respect to the internals we should either use
Amount
everywhere or (almost) nowhere, which seems to be similarly expressed here #823 (comment)The text was updated successfully, but these errors were encountered: