2024-09-01 automated rustfmt nightly

This commit is contained in:
Fmt Bot 2024-09-01 01:22:04 +00:00 committed by github-actions[bot]
parent 753961fdb8
commit fa71b0e044
11 changed files with 38 additions and 41 deletions

View File

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

View File

@ -174,7 +174,8 @@ impl WatchOnly {
/// Creates the PSBT, in BIP174 parlance this is the 'Creator'.
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 (_, 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.)
fn receivers_address() -> Address {
"bc1q7cyrfmck2ffu2ud3rn5l5a8yv6f0chkp0zpemf".parse::<Address<_>>()
"bc1q7cyrfmck2ffu2ud3rn5l5a8yv6f0chkp0zpemf"
.parse::<Address<_>>()
.expect("a valid address")
.require_network(Network::Bitcoin)
.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.)
fn receivers_address() -> Address {
"bc1p0dq0tzg2r780hldthn5mrznmpxsxc0jux5f20fwj0z3wqxxk6fpqm7q0va".parse::<Address<_>>()
"bc1p0dq0tzg2r780hldthn5mrznmpxsxc0jux5f20fwj0z3wqxxk6fpqm7q0va"
.parse::<Address<_>>()
.expect("a valid address")
.require_network(Network::Bitcoin)
.expect("valid address for mainnet")

View File

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

View File

@ -99,12 +99,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
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.
let to_address =
"bcrt1p0p3rvwww0v9znrclp00uneq8ytre9kj922v8fxhnezm3mgsmn9usdxaefc".parse::<Address<_>>()?
.require_network(Network::Regtest)?;
let change_address =
"bcrt1pz449kexzydh2kaypatup5ultru3ej284t6eguhnkn6wkhswt0l7q3a7j76".parse::<Address<_>>()?
.require_network(Network::Regtest)?;
let to_address = "bcrt1p0p3rvwww0v9znrclp00uneq8ytre9kj922v8fxhnezm3mgsmn9usdxaefc"
.parse::<Address<_>>()?
.require_network(Network::Regtest)?;
let change_address = "bcrt1pz449kexzydh2kaypatup5ultru3ej284t6eguhnkn6wkhswt0l7q3a7j76"
.parse::<Address<_>>()?
.require_network(Network::Regtest)?;
let amount_to_send_in_sats = Amount::ONE_BTC;
let change_amount = UTXO_1
.amount_in_sats

View File

@ -3,6 +3,8 @@
#[cfg(doc)]
use core::ops::Deref;
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
use hex::FromHex;
use internals::ToU64 as _;
@ -11,9 +13,6 @@ use crate::opcodes::all::*;
use crate::opcodes::{self, Opcode};
use crate::prelude::{Box, Vec};
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
/// An owned, growable script.
///
/// `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};
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
use hashes::sha256d;
use internals::{write_err, ToU64 as _};
use io::{BufRead, Write};
@ -29,9 +31,6 @@ use crate::sighash::{EcdsaSighashType, TapSighashType};
use crate::witness::Witness;
use crate::{Amount, FeeRate, SignedAmount, VarInt};
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
hashes::hash_newtype! {
/// A bitcoin transaction hash/transaction ID.
///
@ -411,10 +410,7 @@ crate::internal_macros::define_extension_trait! {
#[cfg(feature = "arbitrary")]
impl<'a> Arbitrary<'a> for TxOut {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
Ok(TxOut {
value: Amount::arbitrary(u)?,
script_pubkey: ScriptBuf::arbitrary(u)?,
})
Ok(TxOut { value: Amount::arbitrary(u)?, script_pubkey: ScriptBuf::arbitrary(u)? })
}
}

View File

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

View File

@ -5,15 +5,14 @@
use core::fmt;
use core::ops::{Div, Mul};
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use crate::amount::Amount;
use crate::weight::Weight;
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
/// Represents fee rate.
///
/// 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::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// The factor that non-witness serialization data is multiplied by during weight calculation.
pub const WITNESS_SCALE_FACTOR: usize = 4;