Move base58 module to crate root
In preparation for removing the `util` module move the `base58` module to the crate root. This is likely not the final resting place for this module but it is a step in the right direction. Includes addition of rustfmt attribute to skip formatting the digits array. No other changes to the `base58` module.
This commit is contained in:
parent
cde120bb0f
commit
2780e6cdaa
|
@ -36,6 +36,7 @@ use bech32;
|
|||
use bitcoin_internals::write_err;
|
||||
use secp256k1::{Secp256k1, Verification, XOnlyPublicKey};
|
||||
|
||||
use crate::base58;
|
||||
use crate::blockdata::constants::{
|
||||
MAX_SCRIPT_ELEMENT_SIZE, PUBKEY_ADDRESS_PREFIX_MAIN, PUBKEY_ADDRESS_PREFIX_TEST,
|
||||
SCRIPT_ADDRESS_PREFIX_MAIN, SCRIPT_ADDRESS_PREFIX_TEST,
|
||||
|
@ -51,7 +52,6 @@ use crate::hashes::{sha256, Hash, HashEngine};
|
|||
use crate::network::constants::Network;
|
||||
use crate::prelude::*;
|
||||
use crate::taproot::TapBranchHash;
|
||||
use crate::util::base58;
|
||||
|
||||
/// Address error.
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
|
|
|
@ -16,6 +16,7 @@ use crate::hashes::{sha256d, Hash};
|
|||
|
||||
static BASE58_CHARS: &[u8] = b"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
||||
|
||||
#[rustfmt::skip]
|
||||
static BASE58_DIGITS: [Option<u8>; 128] = [
|
||||
None, None, None, None, None, None, None, None, // 0-7
|
||||
None, None, None, None, None, None, None, None, // 8-15
|
|
@ -18,6 +18,7 @@ use secp256k1::{self, Secp256k1, XOnlyPublicKey};
|
|||
#[cfg(feature = "serde")]
|
||||
use serde;
|
||||
|
||||
use crate::base58;
|
||||
use crate::crypto::key::{self, KeyPair, PrivateKey, PublicKey};
|
||||
use crate::hash_types::XpubIdentifier;
|
||||
use crate::hashes::{hex, sha512, Hash, HashEngine, Hmac, HmacEngine};
|
||||
|
@ -25,7 +26,6 @@ use crate::internal_macros::impl_bytes_newtype;
|
|||
use crate::io::Write;
|
||||
use crate::network::constants::Network;
|
||||
use crate::prelude::*;
|
||||
use crate::util::base58;
|
||||
|
||||
/// A chain code
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
|
|
|
@ -14,11 +14,10 @@ use core::fmt::{self, Write};
|
|||
use bitcoin_internals::write_err;
|
||||
pub use secp256k1::{self, Secp256k1, XOnlyPublicKey, KeyPair};
|
||||
|
||||
use crate::io;
|
||||
use crate::{base58, io};
|
||||
use crate::network::constants::Network;
|
||||
use crate::hashes::{Hash, hash160, hex, hex::FromHex};
|
||||
use crate::hash_types::{PubkeyHash, WPubkeyHash};
|
||||
use crate::util::base58;
|
||||
|
||||
/// A key-related error.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
||||
|
|
|
@ -92,6 +92,7 @@ mod serde_utils;
|
|||
pub mod network;
|
||||
pub mod address;
|
||||
pub mod amount;
|
||||
pub mod base58;
|
||||
pub mod bip152;
|
||||
pub mod bip158;
|
||||
pub mod bip32;
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
//! Functions needed by all parts of the Bitcoin library.
|
||||
//!
|
||||
|
||||
pub mod base58;
|
||||
|
||||
/// The `misc` module was moved and re-named to `sign_message`.
|
||||
pub mod misc {
|
||||
use crate::prelude::*;
|
||||
|
|
Loading…
Reference in New Issue