Skip to content

Commit

Permalink
hide util module and re-export its contents
Browse files Browse the repository at this point in the history
  • Loading branch information
apoelstra committed Nov 29, 2020
1 parent 2f4d915 commit 0643aad
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
11 changes: 5 additions & 6 deletions examples/bip32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ use std::{env, process};
use std::str::FromStr;

use bitcoin::secp256k1::Secp256k1;
use bitcoin::util::key::PrivateKey;
use bitcoin::util::bip32::ExtendedPrivKey;
use bitcoin::util::bip32::ExtendedPubKey;
use bitcoin::util::bip32::DerivationPath;
use bitcoin::util::bip32::ChildNumber;
use bitcoin::util::address::Address;
use bitcoin::bip32::ExtendedPrivKey;
use bitcoin::bip32::ExtendedPubKey;
use bitcoin::bip32::DerivationPath;
use bitcoin::bip32::ChildNumber;
use bitcoin::{Address, PrivateKey};

fn main() {
// This example derives root xprv
Expand Down
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ mod internal_macros;
#[macro_use]
pub mod network;
pub mod primitives;
mod util;
pub mod script;
pub mod util;
pub mod consensus;
pub mod hash_types;
mod hash_types;

pub use hash_types::*;
pub use primitives::block::Block;
Expand All @@ -88,6 +88,10 @@ pub use util::key::PrivateKey;
pub use util::key::PublicKey;
pub use util::merkleblock::MerkleBlock;

pub use util::{address, amount, base58, bip32, bip143, hash, key, merkleblock, misc, psbt, uint, bip158};
#[allow(deprecated)]
pub use util::contracthash;

#[cfg(all(test, feature = "unstable"))] use tests::EmptyWrite;

#[cfg(all(test, feature = "unstable"))]
Expand Down
2 changes: 1 addition & 1 deletion src/util/bip143.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl<R: DerefMut<Target=Transaction>> SigHashCache<R> {
/// This allows in-line signing such as
/// ```
/// use bitcoin::primitives::transaction::{Transaction, SigHashType};
/// use bitcoin::util::bip143::SigHashCache;
/// use bitcoin::bip143::SigHashCache;
/// use bitcoin::Script;
///
/// let mut tx_to_sign = Transaction { version: 2, lock_time: 0, input: Vec::new(), output: Vec::new() };
Expand Down
2 changes: 1 addition & 1 deletion src/util/bip32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ impl DerivationPath {
/// Concatenate `self` with `path` and return the resulting new path.
///
/// ```
/// use bitcoin::util::bip32::{DerivationPath, ChildNumber};
/// use bitcoin::bip32::{DerivationPath, ChildNumber};
/// use std::str::FromStr;
///
/// let base = DerivationPath::from_str("m/42").unwrap();
Expand Down
10 changes: 4 additions & 6 deletions src/util/merkleblock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
//! # Examples
//!
//! ```rust
//! use bitcoin::hash_types::Txid;
//! use bitcoin::hashes::hex::FromHex;
//! use bitcoin::{Block, MerkleBlock};
//! use bitcoin::{Block, MerkleBlock, Txid};
//!
//! // Get the proof from a bitcoind by running in the terminal:
//! // $ TXID="5a4ebf66822b0b2d56bd9dc64ece0bc38ee7844a23ff1d7320a88c5fdb2ad3e2"
Expand Down Expand Up @@ -129,9 +128,9 @@ impl PartialMerkleTree {
/// # Examples
///
/// ```rust
/// use bitcoin::hash_types::Txid;
/// use bitcoin::Txid;
/// use bitcoin::hashes::hex::FromHex;
/// use bitcoin::util::merkleblock::PartialMerkleTree;
/// use bitcoin::merkleblock::PartialMerkleTree;
///
/// // Block 80000
/// let txids: Vec<Txid> = [
Expand Down Expand Up @@ -400,9 +399,8 @@ impl MerkleBlock {
/// # Examples
///
/// ```rust
/// use bitcoin::hash_types::Txid;
/// use bitcoin::hashes::hex::FromHex;
/// use bitcoin::{Block, MerkleBlock};
/// use bitcoin::{Block, MerkleBlock, Txid};
///
/// // Block 80000
/// let block_bytes = Vec::from_hex("01000000ba8b9cda965dd8e536670f9ddec10e53aab14b20bacad2\
Expand Down
2 changes: 1 addition & 1 deletion src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub mod psbt;
pub mod uint;
pub mod bip158;

pub(crate) mod endian;
pub mod endian;

/// A trait which allows numbers to act as fixed-size bit arrays
pub trait BitArray {
Expand Down

0 comments on commit 0643aad

Please sign in to comment.