Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions bitcoin/src/bip152.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,20 @@ impl<'a> Arbitrary<'a> for HeaderAndShortIds {
#[cfg(feature = "arbitrary")]
impl<'a> Arbitrary<'a> for BlockTransactions {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
Ok(BlockTransactions { block_hash: u.arbitrary()?, transactions: Vec::<Transaction>::arbitrary(u)? })
Ok(BlockTransactions {
block_hash: u.arbitrary()?,
transactions: Vec::<Transaction>::arbitrary(u)?,
})
}
}

#[cfg(feature = "arbitrary")]
impl<'a> Arbitrary<'a> for BlockTransactionsRequest {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
Ok(BlockTransactionsRequest { block_hash: u.arbitrary()?, indexes: Vec::<u64>::arbitrary(u)? })
Ok(BlockTransactionsRequest {
block_hash: u.arbitrary()?,
indexes: Vec::<u64>::arbitrary(u)?,
})
}
}

Expand Down
4 changes: 2 additions & 2 deletions bitcoin/src/psbt/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//! <https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki>.

use core::fmt;

#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};

use internals::ToU64 as _;
use io::{BufRead, Write};

Expand Down Expand Up @@ -197,7 +197,7 @@ impl<'a> Arbitrary<'a> for ProprietaryKey {
Ok(ProprietaryKey {
prefix: Vec::<u8>::arbitrary(u)?,
subtype: u64::arbitrary(u)?,
key: Vec::<u8>::arbitrary(u)?
key: Vec::<u8>::arbitrary(u)?,
})
}
}
Expand Down
16 changes: 9 additions & 7 deletions p2p/src/message_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,20 @@ impl_consensus_encoding!(Reject, message, ccode, reason, hash);
pub struct Alert(Vec<u8>);

impl Alert {
const FINAL_ALERT: [u8; 96] = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 127, 0, 0, 0, 0, 255, 255, 255, 127, 254, 255, 255, 127, 1, 255, 255, 255, 127, 0, 0, 0, 0, 255, 255, 255, 127, 0, 255, 255, 255, 127, 0, 47, 85, 82, 71, 69, 78, 84, 58, 32, 65, 108, 101, 114, 116, 32, 107, 101, 121, 32, 99, 111, 109, 112, 114, 111, 109, 105, 115, 101, 100, 44, 32, 117, 112, 103, 114, 97, 100, 101, 32, 114, 101, 113, 117, 105, 114, 101, 100, 0];
const FINAL_ALERT: [u8; 96] = [
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 127, 0, 0, 0, 0, 255, 255, 255, 127,
254, 255, 255, 127, 1, 255, 255, 255, 127, 0, 0, 0, 0, 255, 255, 255, 127, 0, 255, 255,
255, 127, 0, 47, 85, 82, 71, 69, 78, 84, 58, 32, 65, 108, 101, 114, 116, 32, 107, 101, 121,
32, 99, 111, 109, 112, 114, 111, 109, 105, 115, 101, 100, 44, 32, 117, 112, 103, 114, 97,
100, 101, 32, 114, 101, 113, 117, 105, 114, 101, 100, 0,
];

/// Build the final alert to send to a potentially vulerable peer.
pub fn final_alert() -> Self {
Self(Self::FINAL_ALERT.into())
}
pub fn final_alert() -> Self { Self(Self::FINAL_ALERT.into()) }

/// The final alert advertised by Bitcoin Core. This alert is sent if the advertised protocol
/// version is vulerable to the alert-system vulerablities.
pub fn is_final_alert(&self) -> bool {
self.0.eq(&Self::FINAL_ALERT)
}
pub fn is_final_alert(&self) -> bool { self.0.eq(&Self::FINAL_ALERT) }
}

impl_vec_wrapper!(Alert, Vec<u8>);
Expand Down