Skip to content
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

refactor(wallet): use Amount everywhere #1595

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

ValuedMammal
Copy link
Contributor

This is a followup to #1426 that refactors wallet internals to use bitcoin::Amount (nearly) everywhere. I chose not to change any public types in coin_selection.rs that still use u64 as that might require more discussion.

partially addresses #1432
fixes #1434

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

@ValuedMammal ValuedMammal self-assigned this Sep 9, 2024
@ValuedMammal ValuedMammal added this to the 1.0.0-beta milestone Sep 9, 2024
Copy link
Contributor

@oleonardolima oleonardolima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 292ec3c

Comment on lines 35 to 39
impl IsDust for u64 {
fn is_dust(&self, script: &Script) -> bool {
*self < script.minimal_non_dust().to_sat()
Amount::from_sat(*self).is_dust(script)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I guess this could be moved to coin_selection, it's the only place still using is_dust with a u64, right ?

let mut tx_builder = wallet.build_tx();
tx_builder
.add_recipient(faucet_address.script_pubkey(), SEND_AMOUNT)
.add_recipient(address.script_pubkey(), SEND_AMOUNT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks for cleaning this up!

Copy link
Member

@notmandatory notmandatory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 292ec3c

@notmandatory notmandatory merged commit 90a89bf into bitcoindevkit:master Sep 9, 2024
21 checks passed
@ValuedMammal ValuedMammal deleted the refactor/Amount branch September 10, 2024 04:26
This was referenced Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

example: Fix wallet examples
3 participants