Remove trailing whitespace

Remove trailing whitespace from all rust source files.

Done with:

find . -name *.rs | xargs perl -pli -e "s/\s*$//"
This commit is contained in:
Tobin Harding 2022-01-24 11:24:32 +11:00
parent efa9555ebd
commit 1c502399f1
3 changed files with 14 additions and 14 deletions

View File

@ -112,9 +112,9 @@ impl fmt::Debug for Address {
let ipv6 = Ipv6Addr::from(self.address);
match ipv6.to_ipv4() {
Some(addr) => write!(f, "Address {{services: {}, address: {}, port: {}}}",
Some(addr) => write!(f, "Address {{services: {}, address: {}, port: {}}}",
self.services, addr, self.port),
None => write!(f, "Address {{services: {}, address: {}, port: {}}}",
None => write!(f, "Address {{services: {}, address: {}, port: {}}}",
self.services, ipv6, self.port)
}
}
@ -149,7 +149,7 @@ pub enum AddrV2 {
impl Encodable for AddrV2 {
fn consensus_encode<W: io::Write>(&self, e: W) -> Result<usize, io::Error> {
fn encode_addr<W: io::Write>(mut e: W, network: u8, bytes: &[u8]) -> Result<usize, io::Error> {
let len =
let len =
network.consensus_encode(&mut e)? +
VarInt(bytes.len() as u64).consensus_encode(&mut e)? +
bytes.len();
@ -182,7 +182,7 @@ impl Decodable for AddrV2 {
}
let addr: [u8; 4] = Decodable::consensus_decode(&mut d)?;
AddrV2::Ipv4(Ipv4Addr::new(addr[0], addr[1], addr[2], addr[3]))
},
},
2 => {
if len != 16 {
return Err(encode::Error::ParseFailed("Invalid IPv6 address"));
@ -198,7 +198,7 @@ impl Decodable for AddrV2 {
addr[0],addr[1],addr[2],addr[3],
addr[4],addr[5],addr[6],addr[7]
))
},
},
3 => {
if len != 10 {
return Err(encode::Error::ParseFailed("Invalid TorV2 address"));
@ -219,7 +219,7 @@ impl Decodable for AddrV2 {
}
let hash = Decodable::consensus_decode(&mut d)?;
AddrV2::I2p(hash)
},
},
6 => {
if len != 16 {
return Err(encode::Error::ParseFailed("Invalid CJDNS address"));
@ -240,7 +240,7 @@ impl Decodable for AddrV2 {
let mut addr = vec![0u8; len as usize];
d.read_slice(&mut addr)?;
AddrV2::Unknown(network_id, addr)
}
}
})
}
}
@ -282,7 +282,7 @@ impl Encodable for AddrV2Message {
//TODO `len += io::Write::write(&mut e, &self.port.to_be_bytes())?;` when MSRV >= 1.32
len += self.port.swap_bytes().consensus_encode(e)?;
Ok(len)
}
}
}
impl Decodable for AddrV2Message {

View File

@ -144,7 +144,7 @@ impl ServiceFlags {
/// WITNESS indicates that a node can be asked for blocks and transactions including witness
/// data.
pub const WITNESS: ServiceFlags = ServiceFlags(1 << 3);
/// COMPACT_FILTERS means the node will service basic block filter requests.
/// See BIP157 and BIP158 for details on how this is implemented.
pub const COMPACT_FILTERS: ServiceFlags = ServiceFlags(1 << 6);
@ -371,7 +371,7 @@ mod tests {
flags2 ^= ServiceFlags::WITNESS;
assert_eq!(flags2, ServiceFlags::GETUTXO);
flags2 |= ServiceFlags::COMPACT_FILTERS;
flags2 ^= ServiceFlags::GETUTXO;
assert_eq!(flags2, ServiceFlags::COMPACT_FILTERS);

View File

@ -29,21 +29,21 @@
//! fn get_script_for_coin(coin: &OutPoint) -> Result<Script, BlockFilterError> {
//! // get utxo ...
//! }
//!
//!
//! // create a block filter for a block (server side)
//! let filter = BlockFilter::new_script_filter(&block, get_script_for_coin)?;
//!
//! // or create a filter from known raw data
//! let filter = BlockFilter::new(content);
//!
//!
//! // read and evaluate a filter
//!
//!
//! let query: Iterator<Item=Script> = // .. some scripts you care about
//! if filter.match_any(&block_hash, &mut query.map(|s| s.as_bytes())) {
//! // get this block
//! }
//! ```
//!
//!
use prelude::*;