Merge rust-bitcoin/rust-bitcoin#3279: Automated nightly rustfmt (2024-09-01)

fa71b0e044 2024-09-01 automated rustfmt nightly (Fmt Bot)

Pull request description:

  Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

ACKs for top commit:
  apoelstra:
    ACK fa71b0e044 successfully ran local tests; a bit big this week

Tree-SHA512: 875e8d54a06a22ccbef690a21f9d48a0acc1e6ea073a2d16632dd7ce63400cc7f2522339b7cb808653dade407517cd03d4fece4c8dec24abacf5303418aeaa75
This commit is contained in:
merge-script 2024-09-01 13:03:01 +00:00
commit 0a3f5330a8
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
11 changed files with 38 additions and 41 deletions

View File

@ -248,6 +248,7 @@ where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use alloc::vec; use alloc::vec;
use hex::test_hex_unwrap as hex; use hex::test_hex_unwrap as hex;
use super::*; use super::*;

View File

@ -174,7 +174,8 @@ impl WatchOnly {
/// Creates the PSBT, in BIP174 parlance this is the 'Creator'. /// Creates the PSBT, in BIP174 parlance this is the 'Creator'.
fn create_psbt<C: Verification>(&self, secp: &Secp256k1<C>) -> Result<Psbt> { fn create_psbt<C: Verification>(&self, secp: &Secp256k1<C>) -> Result<Psbt> {
let to_address = RECEIVE_ADDRESS.parse::<Address<_>>()?.require_network(Network::Regtest)?; let to_address =
RECEIVE_ADDRESS.parse::<Address<_>>()?.require_network(Network::Regtest)?;
let to_amount = OUTPUT_AMOUNT_BTC.parse::<Amount>()?; let to_amount = OUTPUT_AMOUNT_BTC.parse::<Amount>()?;
let (_, change_address, _) = self.change_address(secp)?; let (_, change_address, _) = self.change_address(secp)?;

View File

@ -100,7 +100,8 @@ fn senders_keys<C: Signing>(secp: &Secp256k1<C>) -> (SecretKey, WPubkeyHash) {
/// ///
/// (FWIW this is a random mainnet address from block 80219.) /// (FWIW this is a random mainnet address from block 80219.)
fn receivers_address() -> Address { fn receivers_address() -> Address {
"bc1q7cyrfmck2ffu2ud3rn5l5a8yv6f0chkp0zpemf".parse::<Address<_>>() "bc1q7cyrfmck2ffu2ud3rn5l5a8yv6f0chkp0zpemf"
.parse::<Address<_>>()
.expect("a valid address") .expect("a valid address")
.require_network(Network::Bitcoin) .require_network(Network::Bitcoin)
.expect("valid address for mainnet") .expect("valid address for mainnet")

View File

@ -97,7 +97,8 @@ fn senders_keys<C: Signing>(secp: &Secp256k1<C>) -> Keypair {
/// ///
/// (FWIW this is an arbitrary mainnet address from block 805222.) /// (FWIW this is an arbitrary mainnet address from block 805222.)
fn receivers_address() -> Address { fn receivers_address() -> Address {
"bc1p0dq0tzg2r780hldthn5mrznmpxsxc0jux5f20fwj0z3wqxxk6fpqm7q0va".parse::<Address<_>>() "bc1p0dq0tzg2r780hldthn5mrznmpxsxc0jux5f20fwj0z3wqxxk6fpqm7q0va"
.parse::<Address<_>>()
.expect("a valid address") .expect("a valid address")
.require_network(Network::Bitcoin) .require_network(Network::Bitcoin)
.expect("valid address for mainnet") .expect("valid address for mainnet")

View File

@ -94,7 +94,8 @@ fn get_tap_key_origin(
// The address to send to. // The address to send to.
fn receivers_address() -> Address { fn receivers_address() -> Address {
"bc1p0dq0tzg2r780hldthn5mrznmpxsxc0jux5f20fwj0z3wqxxk6fpqm7q0va".parse::<Address<_>>() "bc1p0dq0tzg2r780hldthn5mrznmpxsxc0jux5f20fwj0z3wqxxk6fpqm7q0va"
.parse::<Address<_>>()
.expect("a valid address") .expect("a valid address")
.require_network(Network::Bitcoin) .require_network(Network::Bitcoin)
.expect("valid address for mainnet") .expect("valid address for mainnet")
@ -102,8 +103,8 @@ fn receivers_address() -> Address {
// The dummy unspent transaction outputs that we control. // The dummy unspent transaction outputs that we control.
fn dummy_unspent_transaction_outputs() -> Vec<(OutPoint, TxOut)> { fn dummy_unspent_transaction_outputs() -> Vec<(OutPoint, TxOut)> {
let script_pubkey_1 = let script_pubkey_1 = "bc1p80lanj0xee8q667aqcnn0xchlykllfsz3gu5skfv9vjsytaujmdqtv52vu"
"bc1p80lanj0xee8q667aqcnn0xchlykllfsz3gu5skfv9vjsytaujmdqtv52vu".parse::<Address<_>>() .parse::<Address<_>>()
.unwrap() .unwrap()
.require_network(Network::Bitcoin) .require_network(Network::Bitcoin)
.unwrap() .unwrap()
@ -116,8 +117,8 @@ fn dummy_unspent_transaction_outputs() -> Vec<(OutPoint, TxOut)> {
let utxo_1 = TxOut { value: DUMMY_UTXO_AMOUNT_INPUT_1, script_pubkey: script_pubkey_1 }; let utxo_1 = TxOut { value: DUMMY_UTXO_AMOUNT_INPUT_1, script_pubkey: script_pubkey_1 };
let script_pubkey_2 = let script_pubkey_2 = "bc1pfd0jmmdnp278vppcw68tkkmquxtq50xchy7f6wdmjtjm7fgsr8dszdcqce"
"bc1pfd0jmmdnp278vppcw68tkkmquxtq50xchy7f6wdmjtjm7fgsr8dszdcqce".parse::<Address<_>>() .parse::<Address<_>>()
.unwrap() .unwrap()
.require_network(Network::Bitcoin) .require_network(Network::Bitcoin)
.unwrap() .unwrap()

View File

@ -99,11 +99,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("\nSTART EXAMPLE 1 - P2TR with a BIP86 commitment, signed with internal key\n"); println!("\nSTART EXAMPLE 1 - P2TR with a BIP86 commitment, signed with internal key\n");
// Just some addresses for outputs from our wallets. Not really important. // Just some addresses for outputs from our wallets. Not really important.
let to_address = let to_address = "bcrt1p0p3rvwww0v9znrclp00uneq8ytre9kj922v8fxhnezm3mgsmn9usdxaefc"
"bcrt1p0p3rvwww0v9znrclp00uneq8ytre9kj922v8fxhnezm3mgsmn9usdxaefc".parse::<Address<_>>()? .parse::<Address<_>>()?
.require_network(Network::Regtest)?; .require_network(Network::Regtest)?;
let change_address = let change_address = "bcrt1pz449kexzydh2kaypatup5ultru3ej284t6eguhnkn6wkhswt0l7q3a7j76"
"bcrt1pz449kexzydh2kaypatup5ultru3ej284t6eguhnkn6wkhswt0l7q3a7j76".parse::<Address<_>>()? .parse::<Address<_>>()?
.require_network(Network::Regtest)?; .require_network(Network::Regtest)?;
let amount_to_send_in_sats = Amount::ONE_BTC; let amount_to_send_in_sats = Amount::ONE_BTC;
let change_amount = UTXO_1 let change_amount = UTXO_1

View File

@ -3,6 +3,8 @@
#[cfg(doc)] #[cfg(doc)]
use core::ops::Deref; use core::ops::Deref;
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
use hex::FromHex; use hex::FromHex;
use internals::ToU64 as _; use internals::ToU64 as _;
@ -11,9 +13,6 @@ use crate::opcodes::all::*;
use crate::opcodes::{self, Opcode}; use crate::opcodes::{self, Opcode};
use crate::prelude::{Box, Vec}; use crate::prelude::{Box, Vec};
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
/// An owned, growable script. /// An owned, growable script.
/// ///
/// `ScriptBuf` is the most common script type that has the ownership over the contents of the /// `ScriptBuf` is the most common script type that has the ownership over the contents of the

View File

@ -12,6 +12,8 @@
use core::{cmp, fmt, str}; use core::{cmp, fmt, str};
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
use hashes::sha256d; use hashes::sha256d;
use internals::{write_err, ToU64 as _}; use internals::{write_err, ToU64 as _};
use io::{BufRead, Write}; use io::{BufRead, Write};
@ -29,9 +31,6 @@ use crate::sighash::{EcdsaSighashType, TapSighashType};
use crate::witness::Witness; use crate::witness::Witness;
use crate::{Amount, FeeRate, SignedAmount, VarInt}; use crate::{Amount, FeeRate, SignedAmount, VarInt};
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
hashes::hash_newtype! { hashes::hash_newtype! {
/// A bitcoin transaction hash/transaction ID. /// A bitcoin transaction hash/transaction ID.
/// ///
@ -411,10 +410,7 @@ crate::internal_macros::define_extension_trait! {
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
impl<'a> Arbitrary<'a> for TxOut { impl<'a> Arbitrary<'a> for TxOut {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> { fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
Ok(TxOut { Ok(TxOut { value: Amount::arbitrary(u)?, script_pubkey: ScriptBuf::arbitrary(u)? })
value: Amount::arbitrary(u)?,
script_pubkey: ScriptBuf::arbitrary(u)?,
})
} }
} }

View File

@ -13,11 +13,10 @@ use core::{default, fmt, ops};
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
use ::serde::{Deserialize, Serialize}; use ::serde::{Deserialize, Serialize};
use internals::error::InputString;
use internals::write_err;
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured}; use arbitrary::{Arbitrary, Unstructured};
use internals::error::InputString;
use internals::write_err;
/// A set of denominations in which amounts can be expressed. /// A set of denominations in which amounts can be expressed.
/// ///

View File

@ -5,15 +5,14 @@
use core::fmt; use core::fmt;
use core::ops::{Div, Mul}; use core::ops::{Div, Mul};
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::amount::Amount; use crate::amount::Amount;
use crate::weight::Weight; use crate::weight::Weight;
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
/// Represents fee rate. /// Represents fee rate.
/// ///
/// This is an integer newtype representing fee rate in `sat/kwu`. It provides protection against mixing /// This is an integer newtype representing fee rate in `sat/kwu`. It provides protection against mixing

View File

@ -5,11 +5,10 @@
use core::fmt; use core::fmt;
use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign}; use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured}; use arbitrary::{Arbitrary, Unstructured};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// The factor that non-witness serialization data is multiplied by during weight calculation. /// The factor that non-witness serialization data is multiplied by during weight calculation.
pub const WITNESS_SCALE_FACTOR: usize = 4; pub const WITNESS_SCALE_FACTOR: usize = 4;