From 592c4f728aac5310046da72656ca2d21567f769d Mon Sep 17 00:00:00 2001 From: Martin Habovstiak Date: Thu, 29 Jul 2021 11:04:18 +0200 Subject: [PATCH 01/15] Edition 2018: apply cargo fix --edition This is the result of running: ``` cargo +1.36.0 fix --edition --all --broken-code --features="base64,rand,use-serde" ``` And manually fixing [cargo fix bug](https://github.com/rust-lang/rust/issues/87578) --- src/blockdata/block.rs | 38 ++++++++++---------- src/blockdata/constants.rs | 28 +++++++-------- src/blockdata/opcodes.rs | 2 +- src/blockdata/script.rs | 36 +++++++++---------- src/blockdata/transaction.rs | 42 +++++++++++----------- src/consensus/encode.rs | 24 ++++++------- src/consensus/params.rs | 4 +-- src/hash_types.rs | 2 +- src/lib.rs | 46 ++++++++++++------------ src/network/address.rs | 14 ++++---- src/network/constants.rs | 6 ++-- src/network/message.rs | 40 ++++++++++----------- src/network/message_blockdata.rs | 16 ++++----- src/network/message_filter.rs | 2 +- src/network/message_network.rs | 22 ++++++------ src/network/mod.rs | 2 +- src/network/stream_reader.rs | 20 +++++------ src/serde_utils.rs | 14 ++++---- src/util/address.rs | 22 ++++++------ src/util/amount.rs | 12 +++---- src/util/base58.rs | 8 ++--- src/util/bip143.rs | 30 ++++++++-------- src/util/bip158.rs | 28 +++++++-------- src/util/bip32.rs | 16 ++++----- src/util/contracthash.rs | 24 ++++++------- src/util/ecdsa.rs | 24 ++++++------- src/util/hash.rs | 8 ++--- src/util/key.rs | 4 +-- src/util/merkleblock.rs | 32 ++++++++--------- src/util/misc.rs | 24 ++++++------- src/util/mod.rs | 8 ++--- src/util/psbt/error.rs | 10 +++--- src/util/psbt/map/global.rs | 24 ++++++------- src/util/psbt/map/input.rs | 30 ++++++++-------- src/util/psbt/map/mod.rs | 10 +++--- src/util/psbt/map/output.rs | 24 ++++++------- src/util/psbt/mod.rs | 60 ++++++++++++++++---------------- src/util/psbt/raw.rs | 12 +++---- src/util/psbt/serialize.rs | 18 +++++----- src/util/taproot.rs | 8 ++--- src/util/uint.rs | 6 ++-- 41 files changed, 400 insertions(+), 400 deletions(-) diff --git a/src/blockdata/block.rs b/src/blockdata/block.rs index 0c53ed42ec..82d3f821d0 100644 --- a/src/blockdata/block.rs +++ b/src/blockdata/block.rs @@ -20,22 +20,22 @@ //! these blocks and the blockchain. //! -use prelude::*; +use crate::prelude::*; use core::fmt; -use util; -use util::Error::{BlockBadTarget, BlockBadProofOfWork}; -use util::hash::bitcoin_merkle_root; -use hashes::{Hash, HashEngine}; -use hash_types::{Wtxid, BlockHash, TxMerkleNode, WitnessMerkleNode, WitnessCommitment}; -use util::uint::Uint256; -use consensus::encode::Encodable; -use network::constants::Network; -use blockdata::transaction::Transaction; -use blockdata::constants::{max_target, WITNESS_SCALE_FACTOR}; -use blockdata::script; -use VarInt; +use crate::util; +use crate::util::Error::{BlockBadTarget, BlockBadProofOfWork}; +use crate::util::hash::bitcoin_merkle_root; +use crate::hashes::{Hash, HashEngine}; +use crate::hash_types::{Wtxid, BlockHash, TxMerkleNode, WitnessMerkleNode, WitnessCommitment}; +use crate::util::uint::Uint256; +use crate::consensus::encode::Encodable; +use crate::network::constants::Network; +use crate::blockdata::transaction::Transaction; +use crate::blockdata::constants::{max_target, WITNESS_SCALE_FACTOR}; +use crate::blockdata::script; +use crate::VarInt; /// A block header, which contains all the block's information except /// the actual transactions @@ -315,13 +315,13 @@ impl ::std::error::Error for Bip34Error {} #[cfg(test)] mod tests { - use hashes::hex::FromHex; + use crate::hashes::hex::FromHex; - use blockdata::block::{Block, BlockHeader}; - use consensus::encode::{deserialize, serialize}; - use util::uint::Uint256; - use util::Error::{BlockBadTarget, BlockBadProofOfWork}; - use network::constants::Network; + use crate::blockdata::block::{Block, BlockHeader}; + use crate::consensus::encode::{deserialize, serialize}; + use crate::util::uint::Uint256; + use crate::util::Error::{BlockBadTarget, BlockBadProofOfWork}; + use crate::network::constants::Network; #[test] fn test_coinbase_and_bip34() { diff --git a/src/blockdata/constants.rs b/src/blockdata/constants.rs index af639f41bd..80b12adfda 100644 --- a/src/blockdata/constants.rs +++ b/src/blockdata/constants.rs @@ -19,18 +19,18 @@ //! single transaction //! -use prelude::*; +use crate::prelude::*; use core::default::Default; -use hashes::hex::{HexIterator, Error as HexError}; -use hashes::sha256d; -use blockdata::opcodes; -use blockdata::script; -use blockdata::transaction::{OutPoint, Transaction, TxOut, TxIn}; -use blockdata::block::{Block, BlockHeader}; -use network::constants::Network; -use util::uint::Uint256; +use crate::hashes::hex::{HexIterator, Error as HexError}; +use crate::hashes::sha256d; +use crate::blockdata::opcodes; +use crate::blockdata::script; +use crate::blockdata::transaction::{OutPoint, Transaction, TxOut, TxIn}; +use crate::blockdata::block::{Block, BlockHeader}; +use crate::network::constants::Network; +use crate::util::uint::Uint256; /// The maximum allowable sequence number pub const MAX_SEQUENCE: u32 = 0xFFFFFFFF; @@ -166,12 +166,12 @@ pub fn genesis_block(network: Network) -> Block { #[cfg(test)] mod test { use core::default::Default; - use hashes::hex::FromHex; + use crate::hashes::hex::FromHex; - use network::constants::Network; - use consensus::encode::serialize; - use blockdata::constants::{genesis_block, bitcoin_genesis_tx}; - use blockdata::constants::{MAX_SEQUENCE, COIN_VALUE}; + use crate::network::constants::Network; + use crate::consensus::encode::serialize; + use crate::blockdata::constants::{genesis_block, bitcoin_genesis_tx}; + use crate::blockdata::constants::{MAX_SEQUENCE, COIN_VALUE}; #[test] fn bitcoin_genesis_first_transaction() { diff --git a/src/blockdata/opcodes.rs b/src/blockdata/opcodes.rs index bf1be28a85..7662f71281 100644 --- a/src/blockdata/opcodes.rs +++ b/src/blockdata/opcodes.rs @@ -22,7 +22,7 @@ #[cfg(feature = "serde")] use serde; -#[cfg(feature = "serde")] use prelude::*; +#[cfg(feature = "serde")] use crate::prelude::*; use core::{fmt, convert::From}; diff --git a/src/blockdata/script.rs b/src/blockdata/script.rs index 42ecab584c..6c5a7b78cd 100644 --- a/src/blockdata/script.rs +++ b/src/blockdata/script.rs @@ -24,23 +24,23 @@ //! This module provides the structures and functions needed to support scripts. //! -use prelude::*; +use crate::prelude::*; -use io; +use crate::io; use core::{fmt, default::Default}; #[cfg(feature = "serde")] use serde; -use hash_types::{PubkeyHash, WPubkeyHash, ScriptHash, WScriptHash}; -use blockdata::opcodes; -use consensus::{encode, Decodable, Encodable}; -use hashes::{Hash, hex}; -use policy::DUST_RELAY_TX_FEE; +use crate::hash_types::{PubkeyHash, WPubkeyHash, ScriptHash, WScriptHash}; +use crate::blockdata::opcodes; +use crate::consensus::{encode, Decodable, Encodable}; +use crate::hashes::{Hash, hex}; +use crate::policy::DUST_RELAY_TX_FEE; #[cfg(feature="bitcoinconsensus")] use bitcoinconsensus; #[cfg(feature="bitcoinconsensus")] use core::convert::From; #[cfg(feature="bitcoinconsensus")] use OutPoint; -use util::ecdsa::PublicKey; +use crate::util::ecdsa::PublicKey; #[derive(Clone, Default, PartialOrd, Ord, PartialEq, Eq, Hash)] /// A Bitcoin script @@ -413,7 +413,7 @@ impl Script { /// Gets the minimum value an output with this script should have in order to be /// broadcastable on today's bitcoin network. - pub fn dust_value(&self) -> ::Amount { + pub fn dust_value(&self) -> crate::Amount { // This must never be lower than Bitcoin Core's GetDustThreshold() (as of v0.21) as it may // otherwise allow users to create transactions which likely can never be // broadcasted/confirmed. @@ -430,7 +430,7 @@ impl Script { self.consensus_encode(&mut sink()).unwrap() as u64 // The serialized size of this script_pubkey }; - ::Amount::from_sat(sats) + crate::Amount::from_sat(sats) } /// Iterate over the script in the form of `Instruction`s, which are an enum covering @@ -827,7 +827,7 @@ impl<'de> serde::Deserialize<'de> for Script { D: serde::Deserializer<'de>, { use core::fmt::Formatter; - use hashes::hex::FromHex; + use crate::hashes::hex::FromHex; struct Visitor; impl<'de> serde::de::Visitor<'de> for Visitor { @@ -900,11 +900,11 @@ mod test { use super::*; use super::build_scriptint; - use hashes::hex::{FromHex, ToHex}; - use consensus::encode::{deserialize, serialize}; - use blockdata::opcodes; - use util::ecdsa::PublicKey; - use util::psbt::serialize::Serialize; + use crate::hashes::hex::{FromHex, ToHex}; + use crate::consensus::encode::{deserialize, serialize}; + use crate::blockdata::opcodes; + use crate::util::ecdsa::PublicKey; + use crate::util::psbt::serialize::Serialize; #[test] fn script() { @@ -1266,7 +1266,7 @@ mod test { // well-known scriptPubKey types. let script_p2wpkh = Builder::new().push_int(0).push_slice(&[42; 20]).into_script(); assert!(script_p2wpkh.is_v0_p2wpkh()); - assert_eq!(script_p2wpkh.dust_value(), ::Amount::from_sat(294)); + assert_eq!(script_p2wpkh.dust_value(), crate::Amount::from_sat(294)); let script_p2pkh = Builder::new() .push_opcode(opcodes::all::OP_DUP) @@ -1276,7 +1276,7 @@ mod test { .push_opcode(opcodes::all::OP_CHECKSIG) .into_script(); assert!(script_p2pkh.is_p2pkh()); - assert_eq!(script_p2pkh.dust_value(), ::Amount::from_sat(546)); + assert_eq!(script_p2pkh.dust_value(), crate::Amount::from_sat(546)); } } diff --git a/src/blockdata/transaction.rs b/src/blockdata/transaction.rs index 4ecac18a21..fb4f24158b 100644 --- a/src/blockdata/transaction.rs +++ b/src/blockdata/transaction.rs @@ -23,23 +23,23 @@ //! This module provides the structures and functions needed to support transactions. //! -use prelude::*; +use crate::prelude::*; -use io; +use crate::io; use core::{fmt, str, default::Default}; #[cfg(feature = "std")] use std::error; -use hashes::{self, Hash, sha256d}; -use hashes::hex::FromHex; +use crate::hashes::{self, Hash, sha256d}; +use crate::hashes::hex::FromHex; -use util::endian; -use blockdata::constants::WITNESS_SCALE_FACTOR; +use crate::util::endian; +use crate::blockdata::constants::WITNESS_SCALE_FACTOR; #[cfg(feature="bitcoinconsensus")] use blockdata::script; -use blockdata::script::Script; -use consensus::{encode, Decodable, Encodable}; -use consensus::encode::MAX_VEC_SIZE; -use hash_types::{SigHash, Txid, Wtxid}; -use VarInt; +use crate::blockdata::script::Script; +use crate::consensus::{encode, Decodable, Encodable}; +use crate::consensus::encode::MAX_VEC_SIZE; +use crate::hash_types::{SigHash, Txid, Wtxid}; +use crate::VarInt; /// A reference to a transaction output #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] @@ -761,16 +761,16 @@ mod tests { use super::{OutPoint, ParseOutPointError, Transaction, TxIn, NonStandardSigHashType}; use core::str::FromStr; - use blockdata::constants::WITNESS_SCALE_FACTOR; - use blockdata::script::Script; - use consensus::encode::serialize; - use consensus::encode::deserialize; + use crate::blockdata::constants::WITNESS_SCALE_FACTOR; + use crate::blockdata::script::Script; + use crate::consensus::encode::serialize; + use crate::consensus::encode::deserialize; - use hashes::Hash; - use hashes::hex::FromHex; + use crate::hashes::Hash; + use crate::hashes::hex::FromHex; - use hash_types::*; - use SigHashType; + use crate::hash_types::*; + use crate::SigHashType; #[test] fn test_outpoint() { @@ -823,8 +823,8 @@ mod tests { #[test] fn test_is_coinbase () { - use network::constants::Network; - use blockdata::constants; + use crate::network::constants::Network; + use crate::blockdata::constants; let genesis = constants::genesis_block(Network::Bitcoin); assert! (genesis.txdata[0].is_coin_base()); diff --git a/src/consensus/encode.rs b/src/consensus/encode.rs index a2f5bcf538..39cb4ed42f 100644 --- a/src/consensus/encode.rs +++ b/src/consensus/encode.rs @@ -29,23 +29,23 @@ //! big-endian decimals, etc.) //! -use prelude::*; +use crate::prelude::*; use core::{fmt, mem, u32, convert::From}; #[cfg(feature = "std")] use std::error; -use hashes::{sha256d, Hash}; -use hash_types::{BlockHash, FilterHash, TxMerkleNode, FilterHeader}; +use crate::hashes::{sha256d, Hash}; +use crate::hash_types::{BlockHash, FilterHash, TxMerkleNode, FilterHeader}; -use io::{self, Cursor, Read}; +use crate::io::{self, Cursor, Read}; -use util::endian; -use util::psbt; -use hashes::hex::ToHex; +use crate::util::endian; +use crate::util::psbt; +use crate::hashes::hex::ToHex; -use blockdata::transaction::{TxOut, Transaction, TxIn}; +use crate::blockdata::transaction::{TxOut, Transaction, TxIn}; #[cfg(feature = "std")] -use network::{message_blockdata::Inventory, address::{Address, AddrV2Message}}; +use crate::network::{message_blockdata::Inventory, address::{Address, AddrV2Message}}; /// Encoding error #[derive(Debug)] @@ -763,11 +763,11 @@ mod tests { use core::{mem::{self, discriminant}, fmt}; use super::{deserialize, serialize, Error, CheckedData, VarInt}; use super::{Transaction, BlockHash, FilterHash, TxMerkleNode, TxOut, TxIn}; - use consensus::{Encodable, deserialize_partial, Decodable}; - use util::endian::{u64_to_array_le, u32_to_array_le, u16_to_array_le}; + use crate::consensus::{Encodable, deserialize_partial, Decodable}; + use crate::util::endian::{u64_to_array_le, u32_to_array_le, u16_to_array_le}; use secp256k1::rand::{thread_rng, Rng}; #[cfg(feature = "std")] - use network::{Address, message_blockdata::Inventory}; + use crate::network::{Address, message_blockdata::Inventory}; #[test] fn serialize_int_test() { diff --git a/src/consensus/params.rs b/src/consensus/params.rs index b3f62f4542..5545c19315 100644 --- a/src/consensus/params.rs +++ b/src/consensus/params.rs @@ -17,8 +17,8 @@ //! This module provides predefined set of parameters for different chains. //! -use network::constants::Network; -use util::uint::Uint256; +use crate::network::constants::Network; +use crate::util::uint::Uint256; /// Lowest possible difficulty for Mainnet. See comment on Params::pow_limit for more info. const MAX_BITS_BITCOIN: Uint256 = Uint256([ diff --git a/src/hash_types.rs b/src/hash_types.rs index 058106deb8..22616a1bde 100644 --- a/src/hash_types.rs +++ b/src/hash_types.rs @@ -16,7 +16,7 @@ //! to avoid mixing data of the same hash format (like SHA256d) but of different meaning //! (transaction id, block hash etc). -use hashes::{Hash, sha256, sha256d, hash160}; +use crate::hashes::{Hash, sha256, sha256d, hash160}; macro_rules! impl_hashencode { ($hashtype:ident) => { diff --git a/src/lib.rs b/src/lib.rs index 5d04b32ad7..478abe8aa6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -88,31 +88,31 @@ pub mod consensus; pub mod hash_types; pub mod policy; -pub use hash_types::*; -pub use blockdata::block::Block; -pub use blockdata::block::BlockHeader; -pub use blockdata::script::Script; -pub use blockdata::transaction::Transaction; -pub use blockdata::transaction::TxIn; -pub use blockdata::transaction::TxOut; -pub use blockdata::transaction::OutPoint; -pub use blockdata::transaction::SigHashType; -pub use consensus::encode::VarInt; -pub use network::constants::Network; -pub use util::Error; -pub use util::address::Address; -pub use util::address::AddressType; -pub use util::amount::Amount; -pub use util::amount::Denomination; -pub use util::amount::SignedAmount; -pub use util::merkleblock::MerkleBlock; - -pub use util::ecdsa; -pub use util::schnorr; +pub use crate::hash_types::*; +pub use crate::blockdata::block::Block; +pub use crate::blockdata::block::BlockHeader; +pub use crate::blockdata::script::Script; +pub use crate::blockdata::transaction::Transaction; +pub use crate::blockdata::transaction::TxIn; +pub use crate::blockdata::transaction::TxOut; +pub use crate::blockdata::transaction::OutPoint; +pub use crate::blockdata::transaction::SigHashType; +pub use crate::consensus::encode::VarInt; +pub use crate::network::constants::Network; +pub use crate::util::Error; +pub use crate::util::address::Address; +pub use crate::util::address::AddressType; +pub use crate::util::amount::Amount; +pub use crate::util::amount::Denomination; +pub use crate::util::amount::SignedAmount; +pub use crate::util::merkleblock::MerkleBlock; + +pub use crate::util::ecdsa; +pub use crate::util::schnorr; #[deprecated(since = "0.26.1", note = "Please use `ecdsa::PrivateKey` instead")] -pub use util::ecdsa::PrivateKey; +pub use crate::util::ecdsa::PrivateKey; #[deprecated(since = "0.26.1", note = "Please use `ecdsa::PublicKey` instead")] -pub use util::ecdsa::PublicKey; +pub use crate::util::ecdsa::PublicKey; #[cfg(feature = "std")] use std::io; diff --git a/src/network/address.rs b/src/network/address.rs index 5c2600494d..3031ff27e3 100644 --- a/src/network/address.rs +++ b/src/network/address.rs @@ -17,14 +17,14 @@ //! This module defines the structures and functions needed to encode //! network addresses in Bitcoin messages. //! -use prelude::*; +use crate::prelude::*; use core::{fmt, iter}; use std::net::{SocketAddr, Ipv6Addr, SocketAddrV4, SocketAddrV6, Ipv4Addr, ToSocketAddrs}; -use io; -use network::constants::ServiceFlags; -use consensus::encode::{self, Decodable, Encodable, VarInt, ReadExt, WriteExt}; +use crate::io; +use crate::network::constants::ServiceFlags; +use crate::consensus::encode::{self, Decodable, Encodable, VarInt, ReadExt, WriteExt}; /// A message which can be sent on the Bitcoin network #[derive(Clone, PartialEq, Eq, Hash)] @@ -306,11 +306,11 @@ impl ToSocketAddrs for AddrV2Message { mod test { use core::str::FromStr; use super::{AddrV2Message, AddrV2, Address}; - use network::constants::ServiceFlags; + use crate::network::constants::ServiceFlags; use std::net::{SocketAddr, IpAddr, Ipv4Addr, Ipv6Addr}; - use hashes::hex::FromHex; + use crate::hashes::hex::FromHex; - use consensus::encode::{deserialize, serialize}; + use crate::consensus::encode::{deserialize, serialize}; #[test] fn serialize_address_test() { diff --git a/src/network/constants.rs b/src/network/constants.rs index 0db6e98c44..1bde47590e 100644 --- a/src/network/constants.rs +++ b/src/network/constants.rs @@ -39,8 +39,8 @@ use core::{fmt, ops, convert::From}; -use io; -use consensus::encode::{self, Encodable, Decodable}; +use crate::io; +use crate::consensus::encode::{self, Encodable, Decodable}; /// Version of the protocol as appearing in network message headers /// This constant is used to signal to other peers which features you support. @@ -292,7 +292,7 @@ impl Decodable for ServiceFlags { #[cfg(test)] mod tests { use super::{Network, ServiceFlags}; - use consensus::encode::{deserialize, serialize}; + use crate::consensus::encode::{deserialize, serialize}; #[test] fn serialize_test() { diff --git a/src/network/message.rs b/src/network/message.rs index 51cb7b0b14..5981fe20b6 100644 --- a/src/network/message.rs +++ b/src/network/message.rs @@ -19,19 +19,19 @@ //! also defines (de)serialization routines for many primitives. //! -use prelude::*; +use crate::prelude::*; use core::{mem, fmt, iter}; -use io; -use blockdata::block; -use blockdata::transaction; -use network::address::{Address, AddrV2Message}; -use network::message_network; -use network::message_blockdata; -use network::message_filter; -use consensus::encode::{CheckedData, Decodable, Encodable, VarInt, MAX_VEC_SIZE}; -use consensus::{encode, serialize}; +use crate::io; +use crate::blockdata::block; +use crate::blockdata::transaction; +use crate::network::address::{Address, AddrV2Message}; +use crate::network::message_network; +use crate::network::message_blockdata; +use crate::network::message_filter; +use crate::consensus::encode::{CheckedData, Decodable, Encodable, VarInt, MAX_VEC_SIZE}; +use crate::consensus::{encode, serialize}; /// The maximum number of [super::message_blockdata::Inventory] items in an `inv` message. /// @@ -386,17 +386,17 @@ impl Decodable for RawNetworkMessage { mod test { use std::net::Ipv4Addr; use super::{RawNetworkMessage, NetworkMessage, CommandString}; - use network::constants::ServiceFlags; - use consensus::encode::{deserialize, deserialize_partial, serialize}; - use hashes::hex::FromHex; - use hashes::sha256d::Hash; - use hashes::Hash as HashTrait; - use network::address::{Address, AddrV2, AddrV2Message}; + use crate::network::constants::ServiceFlags; + use crate::consensus::encode::{deserialize, deserialize_partial, serialize}; + use crate::hashes::hex::FromHex; + use crate::hashes::sha256d::Hash; + use crate::hashes::Hash as HashTrait; + use crate::network::address::{Address, AddrV2, AddrV2Message}; use super::message_network::{Reject, RejectReason, VersionMessage}; - use network::message_blockdata::{Inventory, GetBlocksMessage, GetHeadersMessage}; - use blockdata::block::{Block, BlockHeader}; - use network::message_filter::{GetCFilters, CFilter, GetCFHeaders, CFHeaders, GetCFCheckpt, CFCheckpt}; - use blockdata::transaction::Transaction; + use crate::network::message_blockdata::{Inventory, GetBlocksMessage, GetHeadersMessage}; + use crate::blockdata::block::{Block, BlockHeader}; + use crate::network::message_filter::{GetCFilters, CFilter, GetCFHeaders, CFHeaders, GetCFCheckpt, CFCheckpt}; + use crate::blockdata::transaction::Transaction; fn hash(slice: [u8;32]) -> Hash { Hash::from_slice(&slice).unwrap() diff --git a/src/network/message_blockdata.rs b/src/network/message_blockdata.rs index 7bf7a67582..06815aa95e 100644 --- a/src/network/message_blockdata.rs +++ b/src/network/message_blockdata.rs @@ -18,15 +18,15 @@ //! Bitcoin data (blocks and transactions) around. //! -use prelude::*; +use crate::prelude::*; -use io; +use crate::io; -use hashes::sha256d; +use crate::hashes::sha256d; -use network::constants; -use consensus::encode::{self, Decodable, Encodable}; -use hash_types::{BlockHash, Txid, Wtxid}; +use crate::network::constants; +use crate::consensus::encode::{self, Decodable, Encodable}; +use crate::hash_types::{BlockHash, Txid, Wtxid}; /// An inventory item. #[derive(PartialEq, Eq, Clone, Debug, Copy, Hash, PartialOrd, Ord)] @@ -153,9 +153,9 @@ impl_consensus_encoding!(GetHeadersMessage, version, locator_hashes, stop_hash); mod tests { use super::{Vec, GetHeadersMessage, GetBlocksMessage}; - use hashes::hex::FromHex; + use crate::hashes::hex::FromHex; - use consensus::encode::{deserialize, serialize}; + use crate::consensus::encode::{deserialize, serialize}; use core::default::Default; #[test] diff --git a/src/network/message_filter.rs b/src/network/message_filter.rs index 56be8b7f49..3196e7391a 100644 --- a/src/network/message_filter.rs +++ b/src/network/message_filter.rs @@ -2,7 +2,7 @@ //! BIP157 Client Side Block Filtering network messages //! -use hash_types::{BlockHash, FilterHash, FilterHeader}; +use crate::hash_types::{BlockHash, FilterHash, FilterHeader}; #[derive(PartialEq, Eq, Clone, Debug)] /// getcfilters message diff --git a/src/network/message_network.rs b/src/network/message_network.rs index 5d96b555f6..a876e06790 100644 --- a/src/network/message_network.rs +++ b/src/network/message_network.rs @@ -18,16 +18,16 @@ //! capabilities //! -use prelude::*; +use crate::prelude::*; -use io; +use crate::io; -use network::address::Address; -use network::constants::{self, ServiceFlags}; -use consensus::{Encodable, Decodable, ReadExt}; -use consensus::encode; -use network::message::CommandString; -use hashes::sha256d; +use crate::network::address::Address; +use crate::network::constants::{self, ServiceFlags}; +use crate::consensus::{Encodable, Decodable, ReadExt}; +use crate::consensus::encode; +use crate::network::message::CommandString; +use crate::hashes::sha256d; /// Some simple messages @@ -148,10 +148,10 @@ impl_consensus_encoding!(Reject, message, ccode, reason, hash); mod tests { use super::VersionMessage; - use hashes::hex::FromHex; - use network::constants::ServiceFlags; + use crate::hashes::hex::FromHex; + use crate::network::constants::ServiceFlags; - use consensus::encode::{deserialize, serialize}; + use crate::consensus::encode::{deserialize, serialize}; #[test] fn version_message_test() { diff --git a/src/network/mod.rs b/src/network/mod.rs index bf7a05f813..68cf4e6d58 100644 --- a/src/network/mod.rs +++ b/src/network/mod.rs @@ -18,7 +18,7 @@ //! of Bitcoin data and network messages. //! -use io; +use crate::io; use core::fmt; #[cfg(feature = "std")] use std::error; diff --git a/src/network/stream_reader.rs b/src/network/stream_reader.rs index 80c53a6a8a..db26aaf0fa 100644 --- a/src/network/stream_reader.rs +++ b/src/network/stream_reader.rs @@ -20,12 +20,12 @@ //! (like can happen with reading from TCP socket) //! -use prelude::*; +use crate::prelude::*; use core::fmt; -use io::{self, Read}; +use crate::io::{self, Read}; -use consensus::{encode, Decodable}; +use crate::consensus::{encode, Decodable}; /// Struct used to configure stream reader function pub struct StreamReader { @@ -85,13 +85,13 @@ impl StreamReader { mod test { use std::thread; use std::time::Duration; - use io::{self, BufReader, Write}; + use crate::io::{self, BufReader, Write}; use std::net::{TcpListener, TcpStream, Shutdown}; use std::thread::JoinHandle; - use network::constants::ServiceFlags; + use crate::network::constants::ServiceFlags; use super::StreamReader; - use network::message::{NetworkMessage, RawNetworkMessage}; + use crate::network::message::{NetworkMessage, RawNetworkMessage}; // First, let's define some byte arrays for sample messages - dumps are taken from live // Bitcoin Core node v0.17.1 with Wireshark @@ -315,10 +315,10 @@ mod test { #[test] fn read_block_from_file_test() { - use io; - use consensus::serialize; - use hashes::hex::FromHex; - use Block; + use crate::io; + use crate::consensus::serialize; + use crate::hashes::hex::FromHex; + use crate::Block; let normal_data = Vec::from_hex("010000004ddccd549d28f385ab457e98d1b11ce80bfea2c5ab93015ade4973e400000000bf4473e53794beae34e64fccc471dace6ae544180816f89591894e0f417a914cd74d6e49ffff001d323b3a7b0201000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0804ffff001d026e04ffffffff0100f2052a0100000043410446ef0102d1ec5240f0d061a4246c1bdef63fc3dbab7733052fbbf0ecd8f41fc26bf049ebb4f9527f374280259e7cfa99c48b0e3f39c51347a19a5819651503a5ac00000000010000000321f75f3139a013f50f315b23b0c9a2b6eac31e2bec98e5891c924664889942260000000049483045022100cb2c6b346a978ab8c61b18b5e9397755cbd17d6eb2fe0083ef32e067fa6c785a02206ce44e613f31d9a6b0517e46f3db1576e9812cc98d159bfdaf759a5014081b5c01ffffffff79cda0945903627c3da1f85fc95d0b8ee3e76ae0cfdc9a65d09744b1f8fc85430000000049483045022047957cdd957cfd0becd642f6b84d82f49b6cb4c51a91f49246908af7c3cfdf4a022100e96b46621f1bffcf5ea5982f88cef651e9354f5791602369bf5a82a6cd61a62501fffffffffe09f5fe3ffbf5ee97a54eb5e5069e9da6b4856ee86fc52938c2f979b0f38e82000000004847304402204165be9a4cbab8049e1af9723b96199bfd3e85f44c6b4c0177e3962686b26073022028f638da23fc003760861ad481ead4099312c60030d4cb57820ce4d33812a5ce01ffffffff01009d966b01000000434104ea1feff861b51fe3f5f8a3b12d0f4712db80e919548a80839fc47c6a21e66d957e9c5d8cd108c7a2d2324bad71f9904ac0ae7336507d785b17a2c115e427a32fac00000000").unwrap(); let cutoff_data = Vec::from_hex("010000004ddccd549d28f385ab457e98d1b11ce80bfea2c5ab93015ade4973e400000000bf4473e53794beae34e64fccc471dace6ae544180816f89591894e0f417a914cd74d6e49ffff001d323b3a7b0201000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0804ffff001d026e04ffffffff0100f2052a0100000043410446ef0102d1ec5240f0d061a4246c1bdef63fc3dbab7733052fbbf0ecd8f41fc26bf049ebb4f9527f374280259e7cfa99c48b0e3f39c51347a19a5819651503a5ac00000000010000000321f75f3139a013f50f315b23b0c9a2b6eac31e2bec98e5891c924664889942260000000049483045022100cb2c6b346a978ab8c61b18b5e9397755cbd17d6eb2fe0083ef32e067fa6c785a02206ce44e613f31d9a6b0517e46f3db1576e9812cc98d159bfdaf759a5014081b5c01ffffffff79cda0945903627c3da1f85fc95d0b8ee3e76ae0cfdc9a65d09744b1f8fc85430000000049483045022047957cdd957cfd0becd642f6b84d82f49b6cb4c51a91f49246908af7c3cfdf4a022100e96b46621f1bffcf5ea5982f88cef651e9354f5791602369bf5a82a6cd61a62501fffffffffe09f5fe3ffbf5ee97a54eb5e5069e9da6b4856ee86fc52938c2f979b0f38e82000000004847304402204165be9a4cbab8049e1af9723b96199bfd3e85f44c6b4c0177e3962686b26073022028f638da23fc003760861ad481ead4099312c60030d4cb57820ce4d33812a5ce01ffffffff01009d966b01000000434104ea1feff861b51fe3f5f8a3b12d0f4712db80e919548a80839fc47c6a21e66d957e9c5d8cd108c7a2d2324bad71f9904ac0ae7336507d785b17a2c115e427a32fac").unwrap(); diff --git a/src/serde_utils.rs b/src/serde_utils.rs index 47e9998a27..116c114535 100644 --- a/src/serde_utils.rs +++ b/src/serde_utils.rs @@ -7,8 +7,8 @@ pub mod btreemap_byte_values { // NOTE: This module can be exactly copied to use with HashMap. - use prelude::*; - use hashes::hex::{FromHex, ToHex}; + use crate::prelude::*; + use crate::hashes::hex::{FromHex, ToHex}; use serde; pub fn serialize(v: &BTreeMap>, s: S) @@ -74,7 +74,7 @@ pub mod btreemap_as_seq { // NOTE: This module can be exactly copied to use with HashMap. - use prelude::*; + use crate::prelude::*; use serde; pub fn serialize(v: &BTreeMap, s: S) @@ -143,14 +143,14 @@ pub mod btreemap_as_seq_byte_values { // NOTE: This module can be exactly copied to use with HashMap. - use prelude::*; + use crate::prelude::*; use serde; /// A custom key-value pair type that serialized the bytes as hex. #[derive(Debug, Deserialize)] struct OwnedPair( T, - #[serde(deserialize_with = "::serde_utils::hex_bytes::deserialize")] + #[serde(deserialize_with = "crate::serde_utils::hex_bytes::deserialize")] Vec, ); @@ -158,7 +158,7 @@ pub mod btreemap_as_seq_byte_values { #[derive(Debug, Serialize)] struct BorrowedPair<'a, T: 'static>( &'a T, - #[serde(serialize_with = "::serde_utils::hex_bytes::serialize")] + #[serde(serialize_with = "crate::serde_utils::hex_bytes::serialize")] &'a [u8], ); @@ -222,7 +222,7 @@ pub mod hex_bytes { //! Module for serialization of byte arrays as hex strings. #![allow(missing_docs)] - use hashes::hex::{FromHex, ToHex}; + use crate::hashes::hex::{FromHex, ToHex}; use serde; pub fn serialize(bytes: &T, s: S) -> Result diff --git a/src/util/address.rs b/src/util/address.rs index a3d08dda85..d696d70d75 100644 --- a/src/util/address.rs +++ b/src/util/address.rs @@ -33,19 +33,19 @@ //! let address = Address::p2pkh(&public_key, Network::Bitcoin); //! ``` -use prelude::*; +use crate::prelude::*; use core::fmt; use core::str::FromStr; #[cfg(feature = "std")] use std::error; use bech32; -use hashes::Hash; -use hash_types::{PubkeyHash, WPubkeyHash, ScriptHash, WScriptHash}; -use blockdata::script; -use network::constants::Network; -use util::base58; -use util::ecdsa; +use crate::hashes::Hash; +use crate::hash_types::{PubkeyHash, WPubkeyHash, ScriptHash, WScriptHash}; +use crate::blockdata::script; +use crate::network::constants::Network; +use crate::util::base58; +use crate::util::ecdsa; /// Address error. #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone)] @@ -537,11 +537,11 @@ impl fmt::Debug for Address { mod tests { use core::str::FromStr; - use hashes::hex::{FromHex, ToHex}; + use crate::hashes::hex::{FromHex, ToHex}; - use blockdata::script::Script; - use network::constants::Network::{Bitcoin, Testnet}; - use util::ecdsa::PublicKey; + use crate::blockdata::script::Script; + use crate::network::constants::Network::{Bitcoin, Testnet}; + use crate::util::ecdsa::PublicKey; use super::*; diff --git a/src/util/amount.rs b/src/util/amount.rs index 777501f064..27b73917c7 100644 --- a/src/util/amount.rs +++ b/src/util/amount.rs @@ -14,7 +14,7 @@ //! We refer to the documentation on the types for more information. //! -use prelude::*; +use crate::prelude::*; use core::{ops, default, str::FromStr, cmp::Ordering}; use core::fmt::{self, Write}; @@ -870,7 +870,7 @@ pub mod serde { //! ``` use serde::{Deserialize, Deserializer, Serialize, Serializer}; - use util::amount::{Amount, Denomination, SignedAmount}; + use crate::util::amount::{Amount, Denomination, SignedAmount}; /// This trait is used only to avoid code duplication and naming collisions /// of the different serde serialization crates. @@ -959,7 +959,7 @@ pub mod serde { //! Use with `#[serde(with = "amount::serde::as_sat")]`. use serde::{Deserializer, Serializer}; - use util::amount::serde::SerdeAmount; + use crate::util::amount::serde::SerdeAmount; pub fn serialize(a: &A, s: S) -> Result { a.ser_sat(s) @@ -974,7 +974,7 @@ pub mod serde { //! Use with `#[serde(default, with = "amount::serde::as_sat::opt")]`. use serde::{Deserializer, Serializer, de}; - use util::amount::serde::SerdeAmountForOpt; + use crate::util::amount::serde::SerdeAmountForOpt; use core::fmt; use core::marker::PhantomData; @@ -1022,7 +1022,7 @@ pub mod serde { //! Use with `#[serde(with = "amount::serde::as_btc")]`. use serde::{Deserializer, Serializer}; - use util::amount::serde::SerdeAmount; + use crate::util::amount::serde::SerdeAmount; pub fn serialize(a: &A, s: S) -> Result { a.ser_btc(s) @@ -1037,7 +1037,7 @@ pub mod serde { //! Use with `#[serde(default, with = "amount::serde::as_btc::opt")]`. use serde::{Deserializer, Serializer, de}; - use util::amount::serde::SerdeAmountForOpt; + use crate::util::amount::serde::SerdeAmountForOpt; use core::fmt; use core::marker::PhantomData; diff --git a/src/util/base58.rs b/src/util/base58.rs index 8d2c7279f3..a0e2eaae08 100644 --- a/src/util/base58.rs +++ b/src/util/base58.rs @@ -14,14 +14,14 @@ //! Base58 encoder and decoder -use prelude::*; +use crate::prelude::*; use core::{fmt, str, iter, slice}; -use hashes::{sha256d, Hash}; +use crate::hashes::{sha256d, Hash}; use secp256k1; -use util::{endian, key}; +use crate::util::{endian, key}; /// An error that might occur during base58 decoding #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone)] @@ -257,7 +257,7 @@ impl From for Error { #[cfg(test)] mod tests { use super::*; - use hashes::hex::FromHex; + use crate::hashes::hex::FromHex; #[test] fn test_base58_encode() { diff --git a/src/util/bip143.rs b/src/util/bip143.rs index 963a3c3b11..0d29a1fd16 100644 --- a/src/util/bip143.rs +++ b/src/util/bip143.rs @@ -19,15 +19,15 @@ //! signatures, which are placed in the scriptSig. //! -use hashes::{Hash, sha256d}; -use hash_types::SigHash; -use blockdata::script::Script; -use blockdata::transaction::{Transaction, TxIn, SigHashType}; -use consensus::{encode, Encodable}; +use crate::hashes::{Hash, sha256d}; +use crate::hash_types::SigHash; +use crate::blockdata::script::Script; +use crate::blockdata::transaction::{Transaction, TxIn, SigHashType}; +use crate::consensus::{encode, Encodable}; -use prelude::*; +use crate::prelude::*; -use io; +use crate::io; use core::ops::{Deref, DerefMut}; /// Parts of a sighash which are common across inputs or signatures, and which are @@ -270,14 +270,14 @@ impl> SigHashCache { #[cfg(test)] #[allow(deprecated)] mod tests { - use hash_types::SigHash; - use blockdata::script::Script; - use blockdata::transaction::Transaction; - use consensus::encode::deserialize; - use network::constants::Network; - use util::address::Address; - use util::ecdsa::PublicKey; - use hashes::hex::FromHex; + use crate::hash_types::SigHash; + use crate::blockdata::script::Script; + use crate::blockdata::transaction::Transaction; + use crate::consensus::encode::deserialize; + use crate::network::constants::Network; + use crate::util::address::Address; + use crate::util::ecdsa::PublicKey; + use crate::hashes::hex::FromHex; use super::*; diff --git a/src/util/bip158.rs b/src/util/bip158.rs index 33eecca52d..6092305426 100644 --- a/src/util/bip158.rs +++ b/src/util/bip158.rs @@ -45,21 +45,21 @@ //! ``` //! -use prelude::*; +use crate::prelude::*; -use io::{self as io, Cursor}; +use crate::io::{self as io, Cursor}; use core::fmt::{self, Display, Formatter}; use core::cmp::{self, Ordering}; -use hashes::{Hash, siphash24}; -use hash_types::{BlockHash, FilterHash, FilterHeader}; +use crate::hashes::{Hash, siphash24}; +use crate::hash_types::{BlockHash, FilterHash, FilterHeader}; -use blockdata::block::Block; -use blockdata::script::Script; -use blockdata::transaction::OutPoint; -use consensus::{Decodable, Encodable}; -use consensus::encode::VarInt; -use util::endian; +use crate::blockdata::block::Block; +use crate::blockdata::script::Script; +use crate::blockdata::transaction::OutPoint; +use crate::consensus::{Decodable, Encodable}; +use crate::consensus::encode::VarInt; +use crate::util::endian; /// Golomb encoding parameter as in BIP-158, see also https://gist.github.com/sipa/576d5f09c3b86c3b1b75598d799fc845 const P: u8 = 19; @@ -510,17 +510,17 @@ impl<'a> BitStreamWriter<'a> { #[cfg(test)] mod test { - use io::Cursor; + use crate::io::Cursor; - use hash_types::BlockHash; - use hashes::hex::FromHex; + use crate::hash_types::BlockHash; + use crate::hashes::hex::FromHex; use super::*; extern crate serde_json; use self::serde_json::{Value}; - use consensus::encode::deserialize; + use crate::consensus::encode::deserialize; use std::collections::HashMap; #[test] diff --git a/src/util/bip32.rs b/src/util/bip32.rs index 1e663aabd2..78b81a69a8 100644 --- a/src/util/bip32.rs +++ b/src/util/bip32.rs @@ -16,19 +16,19 @@ //! Implementation of BIP32 hierarchical deterministic wallets, as defined //! at -use prelude::*; +use crate::prelude::*; use core::{fmt, str::FromStr, default::Default}; #[cfg(feature = "std")] use std::error; #[cfg(feature = "serde")] use serde; -use hash_types::XpubIdentifier; -use hashes::{sha512, Hash, HashEngine, Hmac, HmacEngine}; +use crate::hash_types::XpubIdentifier; +use crate::hashes::{sha512, Hash, HashEngine, Hmac, HmacEngine}; use secp256k1::{self, Secp256k1}; -use network::constants::Network; -use util::{base58, endian, key}; -use util::ecdsa::{PublicKey, PrivateKey}; +use crate::network::constants::Network; +use crate::util::{base58, endian, key}; +use crate::util::ecdsa::{PublicKey, PrivateKey}; /// A chain code #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -772,9 +772,9 @@ mod tests { use core::str::FromStr; use secp256k1::{self, Secp256k1}; - use hashes::hex::FromHex; + use crate::hashes::hex::FromHex; - use network::constants::Network::{self, Bitcoin}; + use crate::network::constants::Network::{self, Bitcoin}; #[test] fn test_parse_derivation_path() { diff --git a/src/util/contracthash.rs b/src/util/contracthash.rs index 29e0e90547..d50c696ff3 100644 --- a/src/util/contracthash.rs +++ b/src/util/contracthash.rs @@ -20,20 +20,20 @@ #![cfg_attr(not(test), deprecated)] -use prelude::*; +use crate::prelude::*; use core::fmt; #[cfg(feature = "std")] use std::error; use secp256k1::{self, Secp256k1}; -use PrivateKey; -use PublicKey; -use hashes::{sha256, Hash, HashEngine, Hmac, HmacEngine}; -use blockdata::{opcodes, script}; +use crate::PrivateKey; +use crate::PublicKey; +use crate::hashes::{sha256, Hash, HashEngine, Hmac, HmacEngine}; +use crate::blockdata::{opcodes, script}; -use hash_types::ScriptHash; -use network::constants::Network; -use util::address; +use crate::hash_types::ScriptHash; +use crate::network::constants::Network; +use crate::util::address; /// Encoding of "pubkey here" in script; from Bitcoin Core `src/script/script.h` static PUBKEY: u8 = 0xFE; @@ -280,15 +280,15 @@ pub fn untemplate(script: &script::Script) -> Result<(Template, Vec), #[cfg(test)] mod tests { use secp256k1::Secp256k1; - use hashes::hex::FromHex; + use crate::hashes::hex::FromHex; use secp256k1::rand::thread_rng; use core::str::FromStr; - use blockdata::script::Script; - use network::constants::Network; + use crate::blockdata::script::Script; + use crate::network::constants::Network; use super::*; - use PublicKey; + use crate::PublicKey; macro_rules! hex (($hex:expr) => (Vec::from_hex($hex).unwrap())); macro_rules! hex_key (($hex:expr) => (PublicKey::from_slice(&hex!($hex)).unwrap())); diff --git a/src/util/ecdsa.rs b/src/util/ecdsa.rs index 9e8589f85b..faab3708c1 100644 --- a/src/util/ecdsa.rs +++ b/src/util/ecdsa.rs @@ -16,18 +16,18 @@ //! ECDSA keys used in Bitcoin that can be roundtrip (de)serialized. //! -use prelude::*; +use crate::prelude::*; use core::{ops, str::FromStr}; use core::fmt::{self, Write as _fmtWrite}; -use io; +use crate::io; use secp256k1::{self, Secp256k1}; -use network::constants::Network; -use hashes::{Hash, hash160}; -use hash_types::{PubkeyHash, WPubkeyHash}; -use util::base58; -use util::key::Error; +use crate::network::constants::Network; +use crate::hashes::{Hash, hash160}; +use crate::hash_types::{PubkeyHash, WPubkeyHash}; +use crate::util::base58; +use crate::util::key::Error; /// A Bitcoin ECDSA public key #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -410,14 +410,14 @@ impl<'de> ::serde::Deserialize<'de> for PublicKey { #[cfg(test)] mod tests { - use io; + use crate::io; use super::{PrivateKey, PublicKey}; use secp256k1::Secp256k1; use std::str::FromStr; - use hashes::hex::ToHex; - use network::constants::Network::Testnet; - use network::constants::Network::Bitcoin; - use util::address::Address; + use crate::hashes::hex::ToHex; + use crate::network::constants::Network::Testnet; + use crate::network::constants::Network::Bitcoin; + use crate::util::address::Address; #[test] fn test_key_derivation() { diff --git a/src/util/hash.rs b/src/util/hash.rs index 3f1080976f..3090527cc6 100644 --- a/src/util/hash.rs +++ b/src/util/hash.rs @@ -15,13 +15,13 @@ //! //! Utility functions related to hashing data, including merkleization -use prelude::*; +use crate::prelude::*; -use io; +use crate::io; use core::cmp::min; -use hashes::Hash; -use consensus::encode::Encodable; +use crate::hashes::Hash; +use crate::consensus::encode::Encodable; /// Calculates the merkle root of a list of hashes inline /// into the allocated slice. diff --git a/src/util/key.rs b/src/util/key.rs index fd2cba2841..895f4ea8dd 100644 --- a/src/util/key.rs +++ b/src/util/key.rs @@ -17,13 +17,13 @@ //! #[deprecated(since = "0.26.1", note = "Please use `util::ecdsa` instead")] -pub use util::ecdsa::{PrivateKey, PublicKey}; +pub use crate::util::ecdsa::{PrivateKey, PublicKey}; use core::fmt; #[cfg(feature = "std")] use std::error; use secp256k1; -use util::base58; +use crate::util::base58; /// A key-related error. #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] diff --git a/src/util/merkleblock.rs b/src/util/merkleblock.rs index 4e28f2a0f3..6bc7aa49d6 100644 --- a/src/util/merkleblock.rs +++ b/src/util/merkleblock.rs @@ -51,18 +51,18 @@ //! assert_eq!(1, index.len()); //! assert_eq!(1, index[0]); //! ``` -use prelude::*; +use crate::prelude::*; -use io; +use crate::io; -use hashes::Hash; -use hash_types::{Txid, TxMerkleNode}; +use crate::hashes::Hash; +use crate::hash_types::{Txid, TxMerkleNode}; -use blockdata::transaction::Transaction; -use blockdata::constants::{MAX_BLOCK_WEIGHT, MIN_TRANSACTION_WEIGHT}; -use consensus::encode::{self, Decodable, Encodable}; -use util::merkleblock::MerkleBlockError::*; -use {Block, BlockHeader}; +use crate::blockdata::transaction::Transaction; +use crate::blockdata::constants::{MAX_BLOCK_WEIGHT, MIN_TRANSACTION_WEIGHT}; +use crate::consensus::encode::{self, Decodable, Encodable}; +use crate::util::merkleblock::MerkleBlockError::*; +use crate::{Block, BlockHeader}; /// An error when verifying the merkle block #[derive(Clone, PartialEq, Eq, Debug)] @@ -517,15 +517,15 @@ impl Decodable for MerkleBlock { mod tests { use core::cmp::min; - use hashes::Hash; - use hashes::hex::{FromHex, ToHex}; - use hash_types::{Txid, TxMerkleNode}; + use crate::hashes::Hash; + use crate::hashes::hex::{FromHex, ToHex}; + use crate::hash_types::{Txid, TxMerkleNode}; use secp256k1::rand::prelude::*; - use consensus::encode::{deserialize, serialize}; - use util::hash::bitcoin_merkle_root; - use util::merkleblock::{MerkleBlock, PartialMerkleTree}; - use Block; + use crate::consensus::encode::{deserialize, serialize}; + use crate::util::hash::bitcoin_merkle_root; + use crate::util::merkleblock::{MerkleBlock, PartialMerkleTree}; + use crate::Block; #[test] fn pmt_tests() { diff --git a/src/util/misc.rs b/src/util/misc.rs index 0009b1713e..1061b9ad14 100644 --- a/src/util/misc.rs +++ b/src/util/misc.rs @@ -16,12 +16,12 @@ //! //! Various utility functions -use prelude::*; +use crate::prelude::*; -use hashes::{sha256d, Hash, HashEngine}; +use crate::hashes::{sha256d, Hash, HashEngine}; -use blockdata::opcodes; -use consensus::{encode, Encodable}; +use crate::blockdata::opcodes; +use crate::consensus::{encode, Encodable}; #[cfg(feature = "secp-recovery")] pub use self::message_signing::{MessageSignature, MessageSignatureError}; @@ -31,16 +31,16 @@ pub const BITCOIN_SIGNED_MSG_PREFIX: &[u8] = b"\x18Bitcoin Signed Message:\n"; #[cfg(feature = "secp-recovery")] mod message_signing { - #[cfg(feature = "base64")] use prelude::*; + #[cfg(feature = "base64")] use crate::prelude::*; use core::fmt; #[cfg(feature = "std")] use std::error; - use hashes::sha256d; + use crate::hashes::sha256d; use secp256k1; use secp256k1::recovery::{RecoveryId, RecoverableSignature}; - use util::ecdsa::PublicKey; - use util::address::{Address, AddressType}; + use crate::util::ecdsa::PublicKey; + use crate::util::address::{Address, AddressType}; /// An error used for dealing with Bitcoin Signed Messages. #[derive(Debug, PartialEq, Eq)] @@ -248,7 +248,7 @@ pub fn signed_msg_hash(msg: &str) -> sha256d::Hash { #[cfg(test)] mod tests { - use hashes::hex::ToHex; + use crate::hashes::hex::ToHex; use super::script_find_and_remove; use super::signed_msg_hash; @@ -321,11 +321,11 @@ mod tests { assert_eq!(pubkey.compressed, true); assert_eq!(pubkey.key, secp256k1::PublicKey::from_secret_key(&secp, &privkey)); - let p2pkh = ::Address::p2pkh(&pubkey, ::Network::Bitcoin); + let p2pkh = crate::Address::p2pkh(&pubkey, crate::Network::Bitcoin); assert_eq!(signature2.is_signed_by_address(&secp, &p2pkh, msg_hash), Ok(true)); - let p2wpkh = ::Address::p2wpkh(&pubkey, ::Network::Bitcoin).unwrap(); + let p2wpkh = crate::Address::p2wpkh(&pubkey, crate::Network::Bitcoin).unwrap(); assert_eq!(signature2.is_signed_by_address(&secp, &p2wpkh, msg_hash), Ok(false)); - let p2shwpkh = ::Address::p2shwpkh(&pubkey, ::Network::Bitcoin).unwrap(); + let p2shwpkh = crate::Address::p2shwpkh(&pubkey, crate::Network::Bitcoin).unwrap(); assert_eq!(signature2.is_signed_by_address(&secp, &p2shwpkh, msg_hash), Ok(false)); } } diff --git a/src/util/mod.rs b/src/util/mod.rs index d47cf4a3e3..a3d2ee2656 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -35,13 +35,13 @@ pub mod bip158; pub(crate) mod endian; -use prelude::*; -use io; +use crate::prelude::*; +use crate::io; use core::fmt; #[cfg(feature = "std")] use std::error; -use network; -use consensus::encode; +use crate::network; +use crate::consensus::encode; /// A trait which allows numbers to act as fixed-size bit arrays pub trait BitArray { diff --git a/src/util/psbt/error.rs b/src/util/psbt/error.rs index 67d46de2c1..ce7ccb24bb 100644 --- a/src/util/psbt/error.rs +++ b/src/util/psbt/error.rs @@ -12,15 +12,15 @@ // If not, see . // -use prelude::*; +use crate::prelude::*; use core::fmt; -use blockdata::transaction::Transaction; -use consensus::encode; -use util::psbt::raw; +use crate::blockdata::transaction::Transaction; +use crate::consensus::encode; +use crate::util::psbt::raw; -use hashes; +use crate::hashes; #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] /// Enum for marking psbt hash error diff --git a/src/util/psbt/map/global.rs b/src/util/psbt/map/global.rs index 42d856ca4a..69889df1f0 100644 --- a/src/util/psbt/map/global.rs +++ b/src/util/psbt/map/global.rs @@ -12,20 +12,20 @@ // If not, see . // -use prelude::*; +use crate::prelude::*; -use io::{self, Cursor, Read}; +use crate::io::{self, Cursor, Read}; use core::cmp; -use blockdata::transaction::Transaction; -use consensus::{encode, Encodable, Decodable}; -use consensus::encode::MAX_VEC_SIZE; -use util::psbt::map::Map; -use util::psbt::raw; -use util::psbt; -use util::psbt::Error; -use util::endian::u32_to_array_le; -use util::bip32::{ExtendedPubKey, KeySource, Fingerprint, DerivationPath, ChildNumber}; +use crate::blockdata::transaction::Transaction; +use crate::consensus::{encode, Encodable, Decodable}; +use crate::consensus::encode::MAX_VEC_SIZE; +use crate::util::psbt::map::Map; +use crate::util::psbt::raw; +use crate::util::psbt; +use crate::util::psbt::Error; +use crate::util::endian::u32_to_array_le; +use crate::util::bip32::{ExtendedPubKey, KeySource, Fingerprint, DerivationPath, ChildNumber}; /// Type: Unsigned Transaction PSBT_GLOBAL_UNSIGNED_TX = 0x00 const PSBT_GLOBAL_UNSIGNED_TX: u8 = 0x00; @@ -330,7 +330,7 @@ impl Decodable for Global { } } } - Err(::consensus::encode::Error::Psbt(::util::psbt::Error::NoMorePairs)) => break, + Err(crate::consensus::encode::Error::Psbt(crate::util::psbt::Error::NoMorePairs)) => break, Err(e) => return Err(e), } } diff --git a/src/util/psbt/map/input.rs b/src/util/psbt/map/input.rs index 04b0c6e4f6..bced9cafc8 100644 --- a/src/util/psbt/map/input.rs +++ b/src/util/psbt/map/input.rs @@ -12,21 +12,21 @@ // If not, see . // -use prelude::*; - -use io; - -use blockdata::script::Script; -use blockdata::transaction::{SigHashType, Transaction, TxOut}; -use consensus::encode; -use util::bip32::KeySource; -use hashes::{self, hash160, ripemd160, sha256, sha256d}; -use util::ecdsa::PublicKey; -use util::psbt; -use util::psbt::map::Map; -use util::psbt::raw; -use util::psbt::serialize::Deserialize; -use util::psbt::{Error, error}; +use crate::prelude::*; + +use crate::io; + +use crate::blockdata::script::Script; +use crate::blockdata::transaction::{SigHashType, Transaction, TxOut}; +use crate::consensus::encode; +use crate::util::bip32::KeySource; +use crate::hashes::{self, hash160, ripemd160, sha256, sha256d}; +use crate::util::ecdsa::PublicKey; +use crate::util::psbt; +use crate::util::psbt::map::Map; +use crate::util::psbt::raw; +use crate::util::psbt::serialize::Deserialize; +use crate::util::psbt::{Error, error}; /// Type: Non-Witness UTXO PSBT_IN_NON_WITNESS_UTXO = 0x00 const PSBT_IN_NON_WITNESS_UTXO: u8 = 0x00; diff --git a/src/util/psbt/map/mod.rs b/src/util/psbt/map/mod.rs index 1326137811..e00fce762b 100644 --- a/src/util/psbt/map/mod.rs +++ b/src/util/psbt/map/mod.rs @@ -12,13 +12,13 @@ // If not, see . // -use prelude::*; +use crate::prelude::*; -use io; +use crate::io; -use consensus::encode; -use util::psbt; -use util::psbt::raw; +use crate::consensus::encode; +use crate::util::psbt; +use crate::util::psbt::raw; /// A trait that describes a PSBT key-value map. pub trait Map { diff --git a/src/util/psbt/map/output.rs b/src/util/psbt/map/output.rs index 96978ab414..049d566069 100644 --- a/src/util/psbt/map/output.rs +++ b/src/util/psbt/map/output.rs @@ -12,18 +12,18 @@ // If not, see . // -use prelude::*; - -use io; - -use blockdata::script::Script; -use consensus::encode; -use util::bip32::KeySource; -use util::ecdsa::PublicKey; -use util::psbt; -use util::psbt::map::Map; -use util::psbt::raw; -use util::psbt::Error; +use crate::prelude::*; + +use crate::io; + +use crate::blockdata::script::Script; +use crate::consensus::encode; +use crate::util::bip32::KeySource; +use crate::util::ecdsa::PublicKey; +use crate::util::psbt; +use crate::util::psbt::map::Map; +use crate::util::psbt::raw; +use crate::util::psbt::Error; /// Type: Redeem Script PSBT_OUT_REDEEM_SCRIPT = 0x00 const PSBT_OUT_REDEEM_SCRIPT: u8 = 0x00; diff --git a/src/util/psbt/mod.rs b/src/util/psbt/mod.rs index 7f315449b3..03bb002b78 100644 --- a/src/util/psbt/mod.rs +++ b/src/util/psbt/mod.rs @@ -18,14 +18,14 @@ //! defined at //! except we define PSBTs containing non-standard SigHash types as invalid. -use blockdata::script::Script; -use blockdata::transaction::Transaction; -use consensus::{encode, Encodable, Decodable}; -use consensus::encode::MAX_VEC_SIZE; +use crate::blockdata::script::Script; +use crate::blockdata::transaction::Transaction; +use crate::consensus::{encode, Encodable, Decodable}; +use crate::consensus::encode::MAX_VEC_SIZE; -use prelude::*; +use crate::prelude::*; -use io; +use crate::io; mod error; pub use self::error::Error; @@ -99,7 +99,7 @@ mod display_from_str { use super::PartiallySignedTransaction; use core::fmt::{Display, Formatter, self}; use core::str::FromStr; - use consensus::encode::{Error, self}; + use crate::consensus::encode::{Error, self}; use ::base64::display::Base64Display; /// Error happening during PSBT decoding from Base64 string @@ -214,24 +214,24 @@ impl Decodable for PartiallySignedTransaction { #[cfg(test)] mod tests { - use hashes::hex::FromHex; - use hashes::{sha256, hash160, Hash, ripemd160}; - use hash_types::Txid; + use crate::hashes::hex::FromHex; + use crate::hashes::{sha256, hash160, Hash, ripemd160}; + use crate::hash_types::Txid; use secp256k1::Secp256k1; - use blockdata::script::Script; - use blockdata::transaction::{Transaction, TxIn, TxOut, OutPoint}; - use network::constants::Network::Bitcoin; - use consensus::encode::{deserialize, serialize, serialize_hex}; - use util::bip32::{ChildNumber, ExtendedPrivKey, ExtendedPubKey, Fingerprint, KeySource}; - use util::ecdsa::PublicKey; - use util::psbt::map::{Global, Output, Input}; - use util::psbt::raw; + use crate::blockdata::script::Script; + use crate::blockdata::transaction::{Transaction, TxIn, TxOut, OutPoint}; + use crate::network::constants::Network::Bitcoin; + use crate::consensus::encode::{deserialize, serialize, serialize_hex}; + use crate::util::bip32::{ChildNumber, ExtendedPrivKey, ExtendedPubKey, Fingerprint, KeySource}; + use crate::util::ecdsa::PublicKey; + use crate::util::psbt::map::{Global, Output, Input}; + use crate::util::psbt::raw; use super::PartiallySignedTransaction; - use util::psbt::raw::ProprietaryKey; + use crate::util::psbt::raw::ProprietaryKey; use std::collections::BTreeMap; #[test] @@ -371,8 +371,8 @@ mod tests { #[test] fn test_serde_psbt() { //! Create a full PSBT value with various fields filled and make sure it can be JSONized. - use hashes::sha256d; - use util::psbt::map::Input; + use crate::hashes::sha256d; + use crate::util::psbt::map::Input; // create some values to use in the PSBT let tx = Transaction { @@ -470,15 +470,15 @@ mod tests { #[cfg(feature = "base64")] use std::str::FromStr; - use hashes::hex::FromHex; - use hash_types::Txid; + use crate::hashes::hex::FromHex; + use crate::hash_types::Txid; - use blockdata::script::Script; - use blockdata::transaction::{SigHashType, Transaction, TxIn, TxOut, OutPoint}; - use consensus::encode::serialize_hex; - use util::psbt::map::{Map, Global, Input, Output}; - use util::psbt::raw; - use util::psbt::{PartiallySignedTransaction, Error}; + use crate::blockdata::script::Script; + use crate::blockdata::transaction::{SigHashType, Transaction, TxIn, TxOut, OutPoint}; + use crate::consensus::encode::serialize_hex; + use crate::util::psbt::map::{Map, Global, Input, Output}; + use crate::util::psbt::raw; + use crate::util::psbt::{PartiallySignedTransaction, Error}; use std::collections::BTreeMap; #[test] @@ -507,7 +507,7 @@ mod tests { #[test] #[should_panic(expected = "ConsensusEncoding")] fn invalid_vector_2_base64() { - use util::psbt::PsbtParseError; + use crate::util::psbt::PsbtParseError; PartiallySignedTransaction::from_str("cHNidP8BAHUCAAAAASaBcTce3/KF6Tet7qSze3gADAVmy7OtZGQXE8pCFxv2AAAAAAD+////AtPf9QUAAAAAGXapFNDFmQPFusKGh2DpD9UhpGZap2UgiKwA4fUFAAAAABepFDVF5uM7gyxHBQ8k0+65PJwDlIvHh7MuEwAAAQD9pQEBAAAAAAECiaPHHqtNIOA3G7ukzGmPopXJRjr6Ljl/hTPMti+VZ+UBAAAAFxYAFL4Y0VKpsBIDna89p95PUzSe7LmF/////4b4qkOnHf8USIk6UwpyN+9rRgi7st0tAXHmOuxqSJC0AQAAABcWABT+Pp7xp0XpdNkCxDVZQ6vLNL1TU/////8CAMLrCwAAAAAZdqkUhc/xCX/Z4Ai7NK9wnGIZeziXikiIrHL++E4sAAAAF6kUM5cluiHv1irHU6m80GfWx6ajnQWHAkcwRAIgJxK+IuAnDzlPVoMR3HyppolwuAJf3TskAinwf4pfOiQCIAGLONfc0xTnNMkna9b7QPZzMlvEuqFEyADS8vAtsnZcASED0uFWdJQbrUqZY3LLh+GFbTZSYG2YVi/jnF6efkE/IQUCSDBFAiEA0SuFLYXc2WHS9fSrZgZU327tzHlMDDPOXMMJ/7X85Y0CIGczio4OFyXBl/saiK9Z9R5E5CVbIBZ8hoQDHAXR8lkqASECI7cr7vCWXRC+B3jv7NYfysb3mk6haTkzgHNEZPhPKrMAAAAAAA==") // This weird thing is necessary since rustc 0.29 prints out I/O error in a different format than later versions .map_err(|err| match err { diff --git a/src/util/psbt/raw.rs b/src/util/psbt/raw.rs index dbe9922846..d6a85aeb21 100644 --- a/src/util/psbt/raw.rs +++ b/src/util/psbt/raw.rs @@ -17,14 +17,14 @@ //! Raw PSBT key-value pairs as defined at //! . -use prelude::*; +use crate::prelude::*; use core::fmt; -use io; -use consensus::encode::{self, ReadExt, WriteExt, Decodable, Encodable, VarInt, serialize, deserialize, MAX_VEC_SIZE}; -use hashes::hex; -use util::psbt::Error; -use util::read_to_end; +use crate::io; +use crate::consensus::encode::{self, ReadExt, WriteExt, Decodable, Encodable, VarInt, serialize, deserialize, MAX_VEC_SIZE}; +use crate::hashes::hex; +use crate::util::psbt::Error; +use crate::util::read_to_end; /// A PSBT key in its raw byte form. #[derive(Debug, PartialEq, Hash, Eq, Clone, Ord, PartialOrd)] diff --git a/src/util/psbt/serialize.rs b/src/util/psbt/serialize.rs index 7cbf6ee757..b2f104972d 100644 --- a/src/util/psbt/serialize.rs +++ b/src/util/psbt/serialize.rs @@ -17,17 +17,17 @@ //! Defines traits used for (de)serializing PSBT values into/from raw //! bytes in PSBT key-value pairs. -use prelude::*; +use crate::prelude::*; -use io; +use crate::io; -use blockdata::script::Script; -use blockdata::transaction::{SigHashType, Transaction, TxOut}; -use consensus::encode::{self, serialize, Decodable}; -use util::bip32::{ChildNumber, Fingerprint, KeySource}; -use hashes::{hash160, ripemd160, sha256, sha256d, Hash}; -use util::ecdsa::PublicKey; -use util::psbt; +use crate::blockdata::script::Script; +use crate::blockdata::transaction::{SigHashType, Transaction, TxOut}; +use crate::consensus::encode::{self, serialize, Decodable}; +use crate::util::bip32::{ChildNumber, Fingerprint, KeySource}; +use crate::hashes::{hash160, ripemd160, sha256, sha256d, Hash}; +use crate::util::ecdsa::PublicKey; +use crate::util::psbt; /// A trait for serializing a value as raw data for insertion into PSBT /// key-value pairs. diff --git a/src/util/taproot.rs b/src/util/taproot.rs index 6ad1925166..aadf3c486b 100644 --- a/src/util/taproot.rs +++ b/src/util/taproot.rs @@ -14,7 +14,7 @@ //! Taproot //! -use hashes::{sha256, sha256t, Hash}; +use crate::hashes::{sha256, sha256t, Hash}; /// The SHA-256 midstate value for the TapLeaf hash. const MIDSTATE_TAPLEAF: [u8; 32] = [ @@ -79,9 +79,9 @@ sha256t_hash_newtype!(TapSighashHash, TapSighashTag, MIDSTATE_TAPSIGHASH, 64, #[cfg(test)] mod test { use super::*; - use hashes::hex::ToHex; - use hashes::sha256t::Tag; - use hashes::{sha256, Hash, HashEngine}; + use crate::hashes::hex::ToHex; + use crate::hashes::sha256t::Tag; + use crate::hashes::{sha256, Hash, HashEngine}; fn tag_engine(tag_name: &str) -> sha256::HashEngine { let mut engine = sha256::Hash::engine(); diff --git a/src/util/uint.rs b/src/util/uint.rs index a96f431b78..fe7d7270dd 100644 --- a/src/util/uint.rs +++ b/src/util/uint.rs @@ -539,9 +539,9 @@ impl Uint256 { #[cfg(test)] mod tests { - use consensus::{deserialize, serialize}; - use util::uint::{Uint256, Uint128}; - use util::BitArray; + use crate::consensus::{deserialize, serialize}; + use crate::util::uint::{Uint256, Uint128}; + use crate::util::BitArray; #[test] pub fn uint256_bits_test() { From 96ad2fef11c470d2a219ee16521c37cabb9c6744 Mon Sep 17 00:00:00 2001 From: Martin Habovstiak Date: Thu, 29 Jul 2021 11:16:33 +0200 Subject: [PATCH 02/15] Edition changed to 2018 This changes edition to 2018 and manually fixes a few leftover paths. --- Cargo.toml | 1 + src/util/amount.rs | 16 ++++++++-------- src/util/psbt/map/global.rs | 4 ++-- src/util/psbt/map/input.rs | 16 ++++++++-------- src/util/psbt/map/output.rs | 6 +++--- src/util/psbt/raw.rs | 9 +++++---- 6 files changed, 27 insertions(+), 25 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1340806046..2dd872740e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ documentation = "https://docs.rs/bitcoin/" description = "General purpose library for using and interoperating with Bitcoin and other cryptocurrencies." keywords = [ "crypto", "bitcoin" ] readme = "README.md" +edition = "2018" [features] diff --git a/src/util/amount.rs b/src/util/amount.rs index 27b73917c7..363ffeb8f4 100644 --- a/src/util/amount.rs +++ b/src/util/amount.rs @@ -1372,9 +1372,9 @@ mod tests { #[derive(Serialize, Deserialize, PartialEq, Debug)] struct T { - #[serde(with = "::util::amount::serde::as_sat")] + #[serde(with = "crate::util::amount::serde::as_sat")] pub amt: Amount, - #[serde(with = "::util::amount::serde::as_sat")] + #[serde(with = "crate::util::amount::serde::as_sat")] pub samt: SignedAmount, } @@ -1404,9 +1404,9 @@ mod tests { #[derive(Serialize, Deserialize, PartialEq, Debug)] struct T { - #[serde(with = "::util::amount::serde::as_btc")] + #[serde(with = "crate::util::amount::serde::as_btc")] pub amt: Amount, - #[serde(with = "::util::amount::serde::as_btc")] + #[serde(with = "crate::util::amount::serde::as_btc")] pub samt: SignedAmount, } @@ -1438,9 +1438,9 @@ mod tests { #[derive(Serialize, Deserialize, PartialEq, Debug, Eq)] struct T { - #[serde(default, with = "::util::amount::serde::as_btc::opt")] + #[serde(default, with = "crate::util::amount::serde::as_btc::opt")] pub amt: Option, - #[serde(default, with = "::util::amount::serde::as_btc::opt")] + #[serde(default, with = "crate::util::amount::serde::as_btc::opt")] pub samt: Option, } @@ -1481,9 +1481,9 @@ mod tests { #[derive(Serialize, Deserialize, PartialEq, Debug, Eq)] struct T { - #[serde(default, with = "::util::amount::serde::as_sat::opt")] + #[serde(default, with = "crate::util::amount::serde::as_sat::opt")] pub amt: Option, - #[serde(default, with = "::util::amount::serde::as_sat::opt")] + #[serde(default, with = "crate::util::amount::serde::as_sat::opt")] pub samt: Option, } diff --git a/src/util/psbt/map/global.rs b/src/util/psbt/map/global.rs index 69889df1f0..cee83b8211 100644 --- a/src/util/psbt/map/global.rs +++ b/src/util/psbt/map/global.rs @@ -49,10 +49,10 @@ pub struct Global { /// derivation path as defined by BIP 32 pub xpub: BTreeMap, /// Global proprietary key-value pairs. - #[cfg_attr(feature = "serde", serde(with = "::serde_utils::btreemap_as_seq_byte_values"))] + #[cfg_attr(feature = "serde", serde(with = "crate::serde_utils::btreemap_as_seq_byte_values"))] pub proprietary: BTreeMap>, /// Unknown global key-value pairs. - #[cfg_attr(feature = "serde", serde(with = "::serde_utils::btreemap_as_seq_byte_values"))] + #[cfg_attr(feature = "serde", serde(with = "crate::serde_utils::btreemap_as_seq_byte_values"))] pub unknown: BTreeMap>, } diff --git a/src/util/psbt/map/input.rs b/src/util/psbt/map/input.rs index bced9cafc8..48d4b9758e 100644 --- a/src/util/psbt/map/input.rs +++ b/src/util/psbt/map/input.rs @@ -72,7 +72,7 @@ pub struct Input { pub witness_utxo: Option, /// A map from public keys to their corresponding signature as would be /// pushed to the stack from a scriptSig or witness. - #[cfg_attr(feature = "serde", serde(with = "::serde_utils::btreemap_byte_values"))] + #[cfg_attr(feature = "serde", serde(with = "crate::serde_utils::btreemap_byte_values"))] pub partial_sigs: BTreeMap>, /// The sighash type to be used for this input. Signatures for this input /// must use the sighash type. @@ -83,7 +83,7 @@ pub struct Input { pub witness_script: Option