bdk icon indicating copy to clipboard operation
bdk copied to clipboard

Merge `tx_data_traits.rs` into `chain_data.rs`.

Open danielabrozzoni opened this issue 1 year ago • 8 comments

Remove the tx_data_traits.rs file and move all of it's contents into chain_data.rs. Also move the Balance struct into chain_data.rs.

See https://discord.com/channels/753336465005608961/753367451319926827/1161983570538147932

danielabrozzoni avatar Oct 12 '23 11:10 danielabrozzoni

Moved to alpha.4 since this is a functional change we should figure out before the beta release.

notmandatory avatar Nov 13 '23 17:11 notmandatory

A few thoughts:

  • move Balance into tx_graph.rs, as suggested already
  • re-export tx_graph::Balance in chain/src/lib.rs
  • re-export bdk_chain::Balance in bdk::wallet mod (as usual)

Undecided what to do with tx_data_traits and chain_data modules. Maybe rename tx_data_traits.rs to anchor.rs, to emphasize Anchor's structural importance. Or just move everything into chain_data and drop the other file.

ValuedMammal avatar Jan 09 '24 22:01 ValuedMammal

@ValuedMammal I would like to work on this, Should I create two pr's one for moving out Balance and one for droping the tx_data_traits.rs file or complete everything in single pr

startup-dreamer avatar Jan 10 '24 14:01 startup-dreamer

@startup-dreamer A single pr for moving Balance, but I would like to get the opinion of the maintainers before formulating anything concrete.

ValuedMammal avatar Jan 10 '24 15:01 ValuedMammal

@ValuedMammal I would like to work on this, Should I create two pr's one for moving out Balance and one for droping the tx_data_traits.rs file or complete everything in single pr

cc: @danielabrozzoni and @evanlinjin

startup-dreamer avatar Jan 11 '24 08:01 startup-dreamer

This is my proposal (as mentioned in https://github.com/bitcoindevkit/bdk/pull/1272#issuecomment-1891319255):

I think we should have a file chain/types.rs that contains all smaller public traits and structs (replacing chain_data.rs and tx_data_traits.rs files). Balance should be in types.rs.

Also I have removed the first good issue tag and added the discussion tab as the discussion is not final, and I don't want anyone else to give us a PR (we already have two: #1272 and #1175).

Update:

After reading @LLFourn's comment here (https://github.com/bitcoindevkit/bdk/pull/1272#issuecomment-1891383732):

It would be great to avoid a types.rs. This is totally unhelpful name because everything we declare is a type. It's fine to put things in lib.rs if there's no where else it belongs.

It would be fine to put tx_data_traits.rs into chain_data.rs. I don't recall why tx_data_traits.rs was created.

I agree with this - to merge tx_data_traits.rs into chain_data.rs. I think Balance should also go in chain_data.rs.

evanlinjin avatar Jan 15 '24 05:01 evanlinjin

The conclusion is the following:

Remove the tx_data_traits.rs file and move all of it's contents into chain_data.rs. Also move the Balance struct into chain_data.rs.

evanlinjin avatar Jan 16 '24 05:01 evanlinjin

A small change but I think we should push to 2.0 milestone.

notmandatory avatar Mar 20 '24 03:03 notmandatory