Move validation module to consensus_validation
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 commit is contained in:
parent
1c3f39e99e
commit
29b213daca
|
@ -1841,7 +1841,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
|
||||||
|
|
|
@ -9,8 +9,6 @@ pub mod encode;
|
||||||
pub mod params;
|
pub mod params;
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
pub mod serde;
|
pub mod serde;
|
||||||
#[cfg(feature = "bitcoinconsensus")]
|
|
||||||
pub mod validation;
|
|
||||||
|
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
|
|
||||||
|
@ -26,12 +24,6 @@ pub use self::{
|
||||||
params::Params,
|
params::Params,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[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