tidecoin 0.33.0-beta

General purpose library for using and interoperating with Tidecoin.
// SPDX-License-Identifier: CC0-1.0

//! Tidecoin block data.
//!
//! This module defines structures and functions for storing the blocks and
//! transactions which make up the Tidecoin system.

pub mod block;
pub mod constants;
pub mod opcodes;
pub mod script;
pub mod subsidy;
pub mod transaction;
pub mod witness;

#[rustfmt::skip]                // Keep public re-exports separate.
#[doc(inline)]
pub use self::{
    fee_rate::FeeRate,
    weight::Weight
};

/// Implements `FeeRate` and associated features.
pub mod fee_rate {
    #[cfg(feature = "serde")]
    #[doc(inline)]
    pub use units::fee_rate::serde;
    // Re-export everything from the [`units::fee_rate`] module.
    #[doc(inline)]
    pub use units::fee_rate::FeeRate;
}

/// Provides absolute and relative locktimes.
pub mod locktime {
    pub mod absolute {
        //! Provides type [`LockTime`] that implements the logic around nLockTime/OP_CHECKLOCKTIMEVERIFY.
        //!
        //! There are two types of lock time: lock-by-height and lock-by-time, distinguished by
        //! whether `LockTime < LOCKTIME_THRESHOLD`.

        pub use encoding::{self, Decodable, Encodable};

        // Re-export everything from the `units::locktime::absolute` module.
        #[rustfmt::skip]        // Keep public re-exports separate.
        #[doc(inline)]
        pub use units::locktime::absolute::{error, Height, LockTime, MedianTimePast};
        #[doc(no_inline)]
        pub use units::locktime::absolute::{
            ConversionError, IncompatibleHeightError, IncompatibleTimeError, ParseHeightError,
            ParseTimeError,
        };
    }

    pub mod relative {
        //! Provides type [`LockTime`] that implements the logic around nSequence/OP_CHECKSEQUENCEVERIFY.
        //!
        //! There are two types of lock time: lock-by-height and lock-by-time, distinguished by
        //! whether bit 22 of the `u32` consensus value is set.

        // Re-export everything from the `units::locktime::relative` module.
        #[doc(inline)]
        pub use units::locktime::relative::{error, LockTime, NumberOf512Seconds, NumberOfBlocks};
        #[doc(no_inline)]
        pub use units::locktime::relative::{
            DisabledLockTimeError, InvalidHeightError, InvalidTimeError, IsSatisfiedByError,
            IsSatisfiedByHeightError, IsSatisfiedByTimeError, TimeOverflowError,
        };
    }
}

/// Implements `Weight` and associated features.
pub mod weight {
    // Re-export everything from the [`units::weight`] module.
    #[doc(inline)]
    pub use units::weight::Weight;
}