fedimint / fedimint

Federated E-Cash Mint
https://fedimint.org/
MIT License
536 stars 209 forks source link

Remove remnants of `bitcoin` v0.29 #5202

Open tvolk131 opened 2 weeks ago

tvolk131 commented 2 weeks ago

Follow-up to #2356

We've migrated almost all of the codebase to bitcoin v0.30, but there are a few places remaining where we're using v0.29 which require some more care to remove:

  1. PartiallySignedTransaction no longer implements Encodable or Decodable, which is why we're currently converting to/from the v0.29 version when encoding/decoding:

https://github.com/fedimint/fedimint/blob/93c23e154b4faf27e5b3835696d381fd190cabf5/fedimint-core/src/encoding/btc.rs#L48-L67

Ideally we would be able to use impl_encode_decode_bridge!(bitcoin::psbt::PartiallySignedTransaction); like we did prior to the migration to v0.30 but I'm not sure how feasible that is.

  1. bitcoin::network::constants::Magic is encoded/decoded in reverse byte order to v29 (which doesn't have a struct, but instead just uses a u32). See here for details:

https://github.com/fedimint/fedimint/blob/93c23e154b4faf27e5b3835696d381fd190cabf5/fedimint-core/src/bitcoin_migration.rs#L15-L39

  1. bitcoin::hashes::hex::format_hex was removed in v30. For simplicity, we've simply left v29 around to rely on this single function. Let's find a way to retain this behavior without needing v29.