Merge rust-bitcoin/rust-bitcoin#3065: Move `validation` module to `consensus_validation`
29b213daca
Move validation module to consensus_validation (Tobin C. Harding) Pull request description: The `consensus` module is currently doing two things, validation and encoding. These two things are orthogonal. Move the `consensus::validation` module to `consensus_validation`. Remove the function re-exports from `consensus`. This was originally discussed here: https://github.com/rust-bitcoin/rust-bitcoin/issues/2779 ACKs for top commit: Kixunil: ACK29b213daca
apoelstra: ACK29b213daca
Tree-SHA512: 3bd0e43c220b0d89a47e9df0e0c92b776ccc65f5f60d57f413db834acc8e86269379bc9fdd688f8c4f0138db22f8eb8983770afa2d7d53d51acf063f2302121c
This commit is contained in:
commit
d5149c1f54
|
@ -1842,7 +1842,7 @@ mod tests {
|
||||||
fn transaction_verify() {
|
fn transaction_verify() {
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use crate::consensus::validation::TxVerifyError;
|
use crate::consensus_validation::TxVerifyError;
|
||||||
use crate::witness::Witness;
|
use crate::witness::Witness;
|
||||||
|
|
||||||
// a random recent segwit transaction from blockchain using both old and segwit inputs
|
// a random recent segwit transaction from blockchain using both old and segwit inputs
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
pub mod encode;
|
pub mod encode;
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
pub mod serde;
|
pub mod serde;
|
||||||
#[cfg(feature = "bitcoinconsensus")]
|
|
||||||
pub mod validation;
|
|
||||||
|
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
|
|
||||||
|
@ -24,12 +22,6 @@ pub use self::{
|
||||||
encode::{deserialize, deserialize_partial, serialize, Decodable, Encodable, ReadExt, WriteExt},
|
encode::{deserialize, deserialize_partial, serialize, Decodable, Encodable, ReadExt, WriteExt},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "bitcoinconsensus")]
|
|
||||||
#[doc(inline)]
|
|
||||||
pub use self::validation::{
|
|
||||||
verify_script, verify_script_with_flags, verify_transaction, verify_transaction_with_flags,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct IterReader<E: fmt::Debug, I: Iterator<Item = Result<u8, E>>> {
|
struct IterReader<E: fmt::Debug, I: Iterator<Item = Result<u8, E>>> {
|
||||||
iterator: core::iter::Fuse<I>,
|
iterator: core::iter::Fuse<I>,
|
||||||
buf: Option<u8>,
|
buf: Option<u8>,
|
||||||
|
|
|
@ -10,14 +10,14 @@ use internals::write_err;
|
||||||
|
|
||||||
use crate::amount::Amount;
|
use crate::amount::Amount;
|
||||||
#[cfg(doc)]
|
#[cfg(doc)]
|
||||||
use crate::consensus;
|
use crate::consensus_validation;
|
||||||
use crate::consensus::encode;
|
use crate::consensus::encode;
|
||||||
use crate::script::Script;
|
use crate::script::Script;
|
||||||
use crate::transaction::{OutPoint, Transaction, TxOut};
|
use crate::transaction::{OutPoint, Transaction, TxOut};
|
||||||
|
|
||||||
/// Verifies spend of an input script.
|
/// Verifies spend of an input script.
|
||||||
///
|
///
|
||||||
/// Shorthand for [`consensus::verify_script_with_flags`] with flag
|
/// Shorthand for [`consensus_validation::verify_script_with_flags`] with flag
|
||||||
/// [`bitcoinconsensus::VERIFY_ALL_PRE_TAPROOT`].
|
/// [`bitcoinconsensus::VERIFY_ALL_PRE_TAPROOT`].
|
||||||
///
|
///
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
|
@ -72,7 +72,7 @@ pub fn verify_script_with_flags<F: Into<u32>>(
|
||||||
|
|
||||||
/// Verifies that this transaction is able to spend its inputs.
|
/// Verifies that this transaction is able to spend its inputs.
|
||||||
///
|
///
|
||||||
/// Shorthand for [`consensus::verify_transaction_with_flags`] with flag
|
/// Shorthand for [`consensus_validation::verify_transaction_with_flags`] with flag
|
||||||
/// [`bitcoinconsensus::VERIFY_ALL_PRE_TAPROOT`].
|
/// [`bitcoinconsensus::VERIFY_ALL_PRE_TAPROOT`].
|
||||||
///
|
///
|
||||||
/// The `spent` closure should not return the same [`TxOut`] twice!
|
/// The `spent` closure should not return the same [`TxOut`] twice!
|
|
@ -93,6 +93,8 @@ pub mod bip158;
|
||||||
pub mod bip32;
|
pub mod bip32;
|
||||||
pub mod blockdata;
|
pub mod blockdata;
|
||||||
pub mod consensus;
|
pub mod consensus;
|
||||||
|
#[cfg(feature = "bitcoinconsensus")]
|
||||||
|
pub mod consensus_validation;
|
||||||
// Private until we either make this a crate or flatten it - still to be decided.
|
// Private until we either make this a crate or flatten it - still to be decided.
|
||||||
pub(crate) mod crypto;
|
pub(crate) mod crypto;
|
||||||
pub mod hash_types;
|
pub mod hash_types;
|
||||||
|
|
Loading…
Reference in New Issue