From 7c040f4437174692b5a85fdba0de148292566c1a Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 29 Jun 2022 14:54:54 +1000 Subject: [PATCH] Refactor imports Clean up some imports, only do the ones that we are about to touch. - Remove/add whitespace to group by crate - move modules/types to their module instead of using lib wide re-export (this helps minimise future merge conflicts) Re-order imports, refactor only. No logic changes. --- src/util/bip143.rs | 9 +++++---- src/util/ecdsa.rs | 6 ++++-- src/util/psbt/map/input.rs | 6 +++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/util/bip143.rs b/src/util/bip143.rs index 73f40575..c4b35e34 100644 --- a/src/util/bip143.rs +++ b/src/util/bip143.rs @@ -9,15 +9,16 @@ //! signatures, which are placed in the scriptSig. //! +use core::ops::{Deref, DerefMut}; + +use crate::io; + use crate::hashes::Hash; use crate::hash_types::Sighash; use crate::blockdata::script::Script; -use crate::blockdata::witness::Witness; use crate::blockdata::transaction::{Transaction, EcdsaSighashType}; +use crate::blockdata::witness::Witness; use crate::consensus::encode; - -use crate::io; -use core::ops::{Deref, DerefMut}; use crate::util::sighash; /// A replacement for SigHashComponents which supports all sighash modes diff --git a/src/util/ecdsa.rs b/src/util/ecdsa.rs index 9ad215c7..7ae9cff3 100644 --- a/src/util/ecdsa.rs +++ b/src/util/ecdsa.rs @@ -5,12 +5,14 @@ //! //! This module provides ECDSA signatures used Bitcoin that can be roundtrip (de)serialized. -use crate::prelude::*; use core::str::FromStr; use core::{fmt, iter}; + +use secp256k1; + +use crate::prelude::*; use crate::hashes::hex::{self, FromHex}; use crate::blockdata::transaction::NonStandardSighashType; -use secp256k1; use crate::EcdsaSighashType; use crate::internal_macros::write_err; diff --git a/src/util/psbt/map/input.rs b/src/util/psbt/map/input.rs index 754df14b..e6f0d30b 100644 --- a/src/util/psbt/map/input.rs +++ b/src/util/psbt/map/input.rs @@ -2,17 +2,18 @@ use crate::prelude::*; use crate::io; + use core::fmt; use core::str::FromStr; use core::convert::TryFrom; -use secp256k1; +use secp256k1::XOnlyPublicKey; + use crate::blockdata::script::Script; use crate::blockdata::witness::Witness; use crate::blockdata::transaction::{Transaction, TxOut, NonStandardSighashType, SighashTypeParseError}; use crate::consensus::encode; use crate::hashes::{self, hash160, ripemd160, sha256, sha256d}; -use secp256k1::XOnlyPublicKey; use crate::util::bip32::KeySource; use crate::util::psbt; use crate::util::psbt::map::Map; @@ -20,7 +21,6 @@ use crate::util::psbt::raw; use crate::util::psbt::serialize::Deserialize; use crate::util::psbt::{Error, error}; use crate::util::key::PublicKey; - use crate::util::taproot::{ControlBlock, LeafVersion, TapLeafHash, TapBranchHash}; use crate::util::sighash; use crate::{EcdsaSighashType, SchnorrSighashType, EcdsaSig, SchnorrSig};