Skip to content

WIP: Demonstrate usage of the bitcoin-units compat layer#667

Closed
jamillambert wants to merge 1 commit into
rust-bitcoin:masterfrom
jamillambert:0716-compat-layer
Closed

WIP: Demonstrate usage of the bitcoin-units compat layer#667
jamillambert wants to merge 1 commit into
rust-bitcoin:masterfrom
jamillambert:0716-compat-layer

Conversation

@jamillambert

@jamillambert jamillambert commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Depend on the rust-bitcoin compat-layer branch and switch the model layer to stable Amount and Sequence types while preserving the client request helper ergonomics around native bitcoin primitives.

Assisted-by: GPT-5.4

Depend on the rust-bitcoin compat-layer branch and switch the model
layer to stable Amount and Sequence types while preserving the client
request helper ergonomics around native bitcoin primitives.

Assisted-by: GPT-5.4
@jamillambert jamillambert changed the title Patch in the compat layer PR branch WIP: Demonstrate usage of the bitcoin-units compat layer Jul 17, 2026
Comment on lines -740 to 745
let fee = SignedAmount::from_btc(self.fee).map_err(E::Fee)?;
let fee = bitcoin::SignedAmount::from_btc(self.fee).map_err(E::Fee)?;
let change_position = crate::to_u32(self.change_position, "change_position")?;
Ok(model::WalletCreateFundedPsbt { psbt, fee, change_position })

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This can be a stable type, right?

@tcharding

tcharding commented Jul 19, 2026

Copy link
Copy Markdown
Member

Nice! This is pleasant huh. I could bike shed the helper functions and the import alias stuff but as a demo this as awesome, thanks man.

Moving forward we need rust-bitcoin/rust-bitcoin#6248 to land then we can get this in.

By the time we are ready to merge I'd like to see:

  • Agree on style of naming stable vs unstable (eg bitcoin::Amount / comtap::Amount / StableAmount)
  • Agree / bike shed the helper functions (I see they are super useful when mapping)
  • Do all the types in units 1.0.0. one per patch across the whole code base (but lets pin everything else down first before we do the whole codebase, I like your 'model module only' approach here to prove it out
  • PROFIT!

@tcharding

Copy link
Copy Markdown
Member

Please note development has migrated to https://git.rust-bitcoin.org/rust-bitcoin/corepc. Any further comments or pushes here on github may be ignored or lost. Closing since I know @jamillambert is ok with the migration.

@tcharding tcharding closed this Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants