Run formatter on examples/

Remove "examples" from the rustfmt ignore list.
This commit is contained in:
Tobin C. Harding 2022-06-06 13:57:02 +10:00
parent fd1c6589ba
commit 6461e2db8d
3 changed files with 9 additions and 19 deletions

View File

@ -1,17 +1,14 @@
extern crate bitcoin; extern crate bitcoin;
use std::{env, process};
use std::str::FromStr; use std::str::FromStr;
use std::{env, process};
use bitcoin::secp256k1::Secp256k1;
use bitcoin::PublicKey;
use bitcoin::util::bip32::ExtendedPrivKey;
use bitcoin::util::bip32::ExtendedPubKey;
use bitcoin::util::bip32::DerivationPath;
use bitcoin::util::bip32::ChildNumber;
use bitcoin::util::address::Address;
use bitcoin::secp256k1::ffi::types::AlignedType;
use bitcoin::hashes::hex::FromHex; use bitcoin::hashes::hex::FromHex;
use bitcoin::secp256k1::ffi::types::AlignedType;
use bitcoin::secp256k1::Secp256k1;
use bitcoin::util::address::Address;
use bitcoin::util::bip32::{ChildNumber, DerivationPath, ExtendedPrivKey, ExtendedPubKey};
use bitcoin::PublicKey;
fn main() { fn main() {
// This example derives root xprv from a 32-byte seed, // This example derives root xprv from a 32-byte seed,
@ -55,10 +52,7 @@ fn main() {
// generate first receiving address at m/0/0 // generate first receiving address at m/0/0
// manually creating indexes this time // manually creating indexes this time
let zero = ChildNumber::from_normal_idx(0).unwrap(); let zero = ChildNumber::from_normal_idx(0).unwrap();
let public_key = xpub.derive_pub(&secp, &vec![zero, zero]) let public_key = xpub.derive_pub(&secp, &vec![zero, zero]).unwrap().public_key;
.unwrap()
.public_key;
let address = Address::p2wpkh(&PublicKey::new(public_key), network).unwrap(); let address = Address::p2wpkh(&PublicKey::new(public_key), network).unwrap();
println!("First receiving address: {}", address); println!("First receiving address: {}", address);
} }

View File

@ -1,9 +1,9 @@
extern crate bitcoin; extern crate bitcoin;
use std::io::{BufReader, Write};
use std::net::{IpAddr, Ipv4Addr, Shutdown, SocketAddr, TcpStream}; use std::net::{IpAddr, Ipv4Addr, Shutdown, SocketAddr, TcpStream};
use std::time::{SystemTime, UNIX_EPOCH}; use std::time::{SystemTime, UNIX_EPOCH};
use std::{env, process}; use std::{env, process};
use std::io::{Write, BufReader};
use bitcoin::consensus::{encode, Decodable}; use bitcoin::consensus::{encode, Decodable};
use bitcoin::network::{address, constants, message, message_network}; use bitcoin::network::{address, constants, message, message_network};
@ -80,10 +80,7 @@ fn build_version_message(address: SocketAddr) -> message::NetworkMessage {
let services = constants::ServiceFlags::NONE; let services = constants::ServiceFlags::NONE;
// "standard UNIX timestamp in seconds" // "standard UNIX timestamp in seconds"
let timestamp = SystemTime::now() let timestamp = SystemTime::now().duration_since(UNIX_EPOCH).expect("Time error").as_secs();
.duration_since(UNIX_EPOCH)
.expect("Time error")
.as_secs();
// "The network address of the node receiving this message" // "The network address of the node receiving this message"
let addr_recv = address::Address::new(&address, constants::ServiceFlags::NONE); let addr_recv = address::Address::new(&address, constants::ServiceFlags::NONE);

View File

@ -1,6 +1,5 @@
# Eventually this shoud be: ignore = [] # Eventually this shoud be: ignore = []
ignore = [ ignore = [
"examples",
"src", "src",
"src/blockdata", "src/blockdata",
"src/consensus", "src/consensus",