rust-bitcoin-unsafe-fast/bitcoin
Andrew Poelstra 38c8f50e83
Merge rust-bitcoin/rust-bitcoin#1344: Fix `no_std` when `bitcoinconsensus` is enabled
b6f9e47dba Fix `no_std` when `bitcoinconsensus` is enabled (Martin Habovstiak)

Pull request description:

  `default-features = false` was missing previously but blindly adding it would lead to subtle risk of breaking when a crate not needing `std` depends on `bitcoinconsensus` and simultaneously another crate not needing `bitcoinconsensus` depends on `std` and another crate depends on them both.

  This change fixes it by introducing `bitcoinconsensus-std` feature flag and provides a fallback if the flag is off. Unfortunately the fallback has to use a bit of reasonable `unsafe` due to limitations of upcasting.

  The only safe alternatives are not do it and provide worse experience for crates that are affected by the problem above or break the API, which couldn't be backported and would be more annoying to use.

  Closes #1343

  This is considered PoC PR as I realized the possibility of the hack (and necessity of `unsafe`) at the last moment. Things like tests and modifying CONTRIBUTING to change the stance on `unsafe` will be added if `unsafe` is ACKed.

ACKs for top commit:
  tcharding:
    tACK b6f9e47dba
  apoelstra:
    ACK b6f9e47dba

Tree-SHA512: 3a2845f4701c94ff6214749fa490aecf3fd96089df31b15f9d3e0afe3c74329ff2b9054d51244358a79f928aa9d4cf4001fc3ec40a9b0e189323544c4480c709
2022-11-05 13:42:50 +00:00
..
contrib Merge rust-bitcoin/rust-bitcoin#999: examples: Add taproot PSBT example workflow 2022-10-25 16:47:18 +00:00
examples Promote rust-miniscript finalizer 2022-10-27 10:40:45 -04:00
src Merge rust-bitcoin/rust-bitcoin#1344: Fix `no_std` when `bitcoinconsensus` is enabled 2022-11-05 13:42:50 +00:00
tests Add a test parsing transaction with a huge witness 2022-11-01 14:27:38 +01:00
Cargo.toml Merge rust-bitcoin/rust-bitcoin#1344: Fix `no_std` when `bitcoinconsensus` is enabled 2022-11-05 13:42:50 +00:00