Skip to content

Commit

Permalink
Merge #205: Fix CI
Browse files Browse the repository at this point in the history
8d58ec3 clippy: use u32::MAX rather than u32::max_value (Andrew Poelstra)
172e36b clippy: fix indentation in documentation (Andrew Poelstra)
4ab1b77 blech32: delete unconstructable iterator struct (Andrew Poelstra)
a89ff6e fix a couple feature gates (Andrew Poelstra)

Pull request description:

  Do some cleanups and get CI working again.

  Will rebase #203 on this.

ACKs for top commit:
  delta1:
    ACK 8d58ec3

Tree-SHA512: 62ca188d031e71e39279b7407cef746ea4bec2c72baad633603fd67834efa6774027b060d20fddbb9bfff609b676b1b6d2f20a1c663e7fea207a3b08772e3e0c
  • Loading branch information
apoelstra committed Jun 20, 2024
2 parents 487f31b + 8d58ec3 commit a7c5013
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 22 deletions.
1 change: 1 addition & 0 deletions examples/pset_blind_coinjoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
//! 6. A signs it's input
//! 7. A finalizes the pset
//! 8. A extracts and broadcasts the transaction
//!
//! During the entire interaction, the output blinding factors for A and B are not
//! shared with each other.
extern crate bitcoin;
Expand Down
16 changes: 1 addition & 15 deletions src/blech32/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,19 +452,6 @@ impl<'s> ExactSizeIterator for ByteIter<'s> {
fn len(&self) -> usize { self.iter.len() }
}

/// An iterator over a parsed HRP string data as field elements.
pub struct Fe32Iter<'s> {
iter: AsciiToFe32Iter<iter::Copied<slice::Iter<'s, u8>>>,
}

impl<'s> Iterator for Fe32Iter<'s> {
type Item = Fe32;
#[inline]
fn next(&mut self) -> Option<Fe32> { self.iter.next() }
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
}

/// Helper iterator adaptor that maps an iterator of valid bech32 character ASCII bytes to an
/// iterator of field elements.
///
Expand Down Expand Up @@ -889,13 +876,12 @@ mod tests {
}

#[test]
#[cfg(feature = "alloc")]
fn check_hrp_max_length() {
let hrps =
"an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedcharactersbio";

let hrp = Hrp::parse_unchecked(hrps);
let s = crate::encode::<Blech32>(hrp, &[]).expect("failed to encode empty buffer");
let s = crate::bech32::encode::<Blech32>(hrp, &[]).expect("failed to encode empty buffer");

let unchecked = UncheckedHrpstring::new(&s).expect("failed to parse address");
assert_eq!(unchecked.hrp(), hrp);
Expand Down
4 changes: 2 additions & 2 deletions src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,15 +434,15 @@ mod tests {
000000000000000000000000000000000000\
";

#[cfg(feature = "serde-feature")]
#[cfg(feature = "serde")]
#[test]
fn blockheader_serde() {
let block: Block = hex_deserialize!(&SIMPLE_BLOCK);
roundtrip_header(&block.header);
let block: Block = hex_deserialize!(&DYNAFED_BLOCK);
roundtrip_header(&block.header);
}
#[cfg(feature = "serde-feature")]
#[cfg(feature = "serde")]
fn roundtrip_header(header: &BlockHeader) {
let header_ser = serde_json::to_string(header).unwrap();
let header_deser: BlockHeader = serde_json::from_str(&header_ser).unwrap();
Expand Down
7 changes: 4 additions & 3 deletions src/opcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,10 @@ pub mod all {
pub const OP_INSPECTINPUTVALUE: All = All {code: 0xc9};
/// Pop a CScriptNum input index idx and push the following depending the type of scriptPubkey:
/// - If the scriptPubKey is not a native segwit program, push a single sha256
/// hash of the scriptPubKey on stack top. Next, push a CScriptNum(-1) to
/// indicate a non-native segwit scriptPubKey.
/// hash of the scriptPubKey on stack top. Next, push a CScriptNum(-1) to
/// indicate a non-native segwit scriptPubKey.
/// - If the scriptPubKey is a native segwit program, push the witness program(2-40)
/// followed by a push for segwit version(0-1).
/// followed by a push for segwit version(0-1).
pub const OP_INSPECTINPUTSCRIPTPUBKEY: All = All {code: 0xca};
/// Pop a CScriptNum input index idx and push the nSequence(4) as little-endian number.
pub const OP_INSPECTINPUTSEQUENCE: All = All {code: 0xcb};
Expand Down Expand Up @@ -544,6 +544,7 @@ pub mod all {
/// 1) a 32 byte big endian, unsigned scalar k.
/// 2) Compressed EC point P, and
/// 3) compressed EC point Q.
///
/// Abort if P, Q is invalid or k is not 32 bytes and outside of secp256k1 curve order.
/// Abort if Q != k*P.
pub const OP_ECMULSCALARVERIFY: All = All {code: 0xe3};
Expand Down
1 change: 1 addition & 0 deletions src/schnorr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ impl TapTweak for UntweakedKeypair {
/// * p is the internal private key
/// * H is the hash function
/// * c is the commitment data
///
/// The public key is generated from a private key by multiplying with generator point, Q = qG.
///
/// # Returns
Expand Down
2 changes: 1 addition & 1 deletion src/taproot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ impl ControlBlock {
///
/// # Errors:
/// - If the control block size is not of the form 33 + 32m where
/// 0 <= m <= 128, InvalidControlBlock is returned
/// 0 <= m <= 128, InvalidControlBlock is returned
pub fn from_slice(sl: &[u8]) -> Result<ControlBlock, TaprootError> {
if sl.len() < TAPROOT_CONTROL_BASE_SIZE
|| (sl.len() - TAPROOT_CONTROL_BASE_SIZE) % TAPROOT_CONTROL_NODE_SIZE != 0
Expand Down
2 changes: 1 addition & 1 deletion src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl OutPoint {
pub fn null() -> OutPoint {
OutPoint {
txid: Txid::all_zeros(),
vout: u32::max_value(),
vout: u32::MAX,
}
}

Expand Down

0 comments on commit a7c5013

Please sign in to comment.