Fully encapsulate bitcoinconsensus
The `bitcoinconsensus` crate is not fully under our control because it exposes code from Core, so we cannot guarantee its stability across versions. To make our semver compliance easier we can fully encapsulate the `bitcoinconsensus` crate so it does not appear in our public API. However, it is useful to have the crate itself exported, here we add an "unstable" feature and only publicly export the `bitcoinconsensus` crate if the "unstable" feature is enabled.
This commit is contained in:
parent
6fe073b324
commit
43b1ed1b86
|
@ -51,13 +51,13 @@ pub fn verify_script_with_flags<F: Into<u32>>(
|
|||
spending_tx: &[u8],
|
||||
flags: F,
|
||||
) -> Result<(), BitcoinconsensusError> {
|
||||
Ok(bitcoinconsensus::verify_with_flags(
|
||||
bitcoinconsensus::verify_with_flags(
|
||||
script.as_bytes(),
|
||||
amount.to_sat(),
|
||||
spending_tx,
|
||||
index,
|
||||
flags.into(),
|
||||
)?)
|
||||
).map_err(BitcoinconsensusError)
|
||||
}
|
||||
|
||||
/// Verifies that this transaction is able to spend its inputs.
|
||||
|
@ -198,10 +198,6 @@ impl std::error::Error for BitcoinconsensusError {
|
|||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { None }
|
||||
}
|
||||
|
||||
impl From<bitcoinconsensus::Error> for BitcoinconsensusError {
|
||||
fn from(e: bitcoinconsensus::Error) -> Self { Self(e) }
|
||||
}
|
||||
|
||||
/// An error during transaction validation.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[non_exhaustive]
|
||||
|
|
|
@ -59,9 +59,9 @@ pub extern crate base64;
|
|||
/// Encodes and decodes the Bech32 forrmat.
|
||||
pub extern crate bech32;
|
||||
|
||||
#[cfg(feature = "bitcoinconsensus")]
|
||||
/// Bitcoin's libbitcoinconsensus with Rust binding.
|
||||
pub extern crate bitcoinconsensus;
|
||||
#[cfg(feature = "bitcoinconsensus")]
|
||||
extern crate bitcoinconsensus;
|
||||
|
||||
/// Rust implementation of cryptographic hash function algorithems.
|
||||
pub extern crate hashes;
|
||||
|
|
Loading…
Reference in New Issue