What changed, and why it matters
This commit is a pure documentation and comment cleanup. It changes how Bitcoin Improvement Proposal (BIP) numbers are written throughout the codebase from inconsistent styles like 'BIP32', 'BIP 341', and 'BIP-32' to a uniform 'BIP-XXXX' format with four digits and a hyphen. No program logic, code behavior, or security properties were changed.
No security action needed. This is a non-functional style/consistency patch.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit standardizes BIP notation across 44 files in the rust-bitcoin workspace. All changes are in doc comments, regular comments, error message strings, README text, and markdown policy documentation. Identifiers such as module names, function names, variables, and file names are explicitly left unchanged per the updated policy. There are no functional code changes, no algorithm modifications, no serialization changes, and no API changes.
Changed components
Documentation and comments onlyREADME.mddocs/policy.mdbitcoin crate examples and source filesp2p crate source filesprimitives crate source filesunits crate source fileshashes crate source fileschacha20_poly1305 crate source filesInspect captured patch +220 / −205
diff --git a/README.md b/README.md
index 1a287bda..5aa00326 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ Supports (or should support)
* De/serialization of Bitcoin protocol network messages
* De/serialization of blocks and transactions
* Script de/serialization
-* Private keys and address creation, de/serialization and validation (including full BIP32 support)
+* Private keys and address creation, de/serialization and validation (including full BIP-0032 support)
* PSBT v0 de/serialization and all but the Input Finalizer role. Use [rust-miniscript](https://docs.rs/miniscript/latest/miniscript/psbt/index.html) to finalize.
For JSONRPC interaction with Bitcoin Core, it is recommended to use
diff --git a/bitcoin/examples/ecdsa-psbt.rs b/bitcoin/examples/ecdsa-psbt.rs
index a74e9ddb..4d3e2a01 100644
--- a/bitcoin/examples/ecdsa-psbt.rs
+++ b/bitcoin/examples/ecdsa-psbt.rs
@@ -172,7 +172,7 @@ impl WatchOnly {
WatchOnly { account_0_xpub, input_xpub, master_fingerprint }
}
- /// Creates the PSBT, in BIP174 parlance this is the 'Creator'.
+ /// Creates the PSBT, in BIP-0174 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)?;
@@ -201,7 +201,7 @@ impl WatchOnly {
Ok(psbt)
}
- /// Updates the PSBT, in BIP174 parlance this is the 'Updater'.
+ /// Updates the PSBT, in BIP-0174 parlance this is the 'Updater'.
fn update_psbt(&self, mut psbt: Psbt) -> Result<Psbt> {
let mut input = Input { witness_utxo: Some(previous_output()), ..Default::default() };
@@ -225,7 +225,7 @@ impl WatchOnly {
Ok(psbt)
}
- /// Finalizes the PSBT, in BIP174 parlance this is the 'Finalizer'.
+ /// Finalizes the PSBT, in BIP-0174 parlance this is the 'Finalizer'.
/// This is just an example. For a production-ready PSBT Finalizer, use [rust-miniscript](https://docs.rs/miniscript/latest/miniscript/psbt/trait.PsbtExt.html#tymethod.finalize)
fn finalize_psbt(&self, mut psbt: Psbt) -> Result<Psbt> {
if psbt.inputs.is_empty() {
@@ -249,7 +249,7 @@ impl WatchOnly {
Ok(psbt)
}
- /// Returns data for the first change address (standard BIP84 derivation path
+ /// Returns data for the first change address (standard BIP-0084 derivation path
/// "m/84h/0h/0h/1/0"). A real wallet would have access to the chain so could determine if an
/// address has been used or not. We ignore this detail and just re-use the first change address
/// without loss of generality.
diff --git a/bitcoin/examples/sighash.rs b/bitcoin/examples/sighash.rs
index 433638c0..bd54913d 100644
--- a/bitcoin/examples/sighash.rs
+++ b/bitcoin/examples/sighash.rs
@@ -109,7 +109,7 @@ fn compute_sighash_p2wsh(raw_tx: &[u8], inp_idx: usize, amount: Amount) {
let witness = &inp.witness;
println!("witness {witness:?}");
- //last element is called witnessScript according to BIP141. It supersedes scriptPubKey.
+ //last element is called witnessScript according to BIP-0141. It supersedes scriptPubKey.
let witness_script_bytes: &[u8] = witness.last().expect("out of bounds");
let witness_script = Script::from_bytes(witness_script_bytes);
let mut cache = sighash::SighashCache::new(&tx);
diff --git a/bitcoin/examples/taproot-psbt.rs b/bitcoin/examples/taproot-psbt.rs
index c2aa11a7..4d5343a5 100644
--- a/bitcoin/examples/taproot-psbt.rs
+++ b/bitcoin/examples/taproot-psbt.rs
@@ -95,7 +95,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let secp = Secp256k1::new();
println!("\n----------------");
- println!("\nSTART EXAMPLE 1 - P2TR with a BIP86 commitment, signed with internal key\n");
+ println!("\nSTART EXAMPLE 1 - P2TR with a BIP-0086 commitment, signed with internal key\n");
// Just some addresses for outputs from our wallets. Not really important.
let to_address = "bcrt1p0p3rvwww0v9znrclp00uneq8ytre9kj922v8fxhnezm3mgsmn9usdxaefc"
@@ -415,7 +415,7 @@ impl BenefactorWallet {
let value = (input_utxo.amount - ABSOLUTE_FEES)
.expect("ABSOLUTE_FEES must be set below input amount");
- // Spend a normal BIP86-like output as an input in our inheritance funding transaction
+ // Spend a normal BIP-0086-like output as an input in our inheritance funding transaction
let tx = generate_bip86_key_spend_tx(
&self.secp,
self.master_xpriv,
diff --git a/bitcoin/src/address/mod.rs b/bitcoin/src/address/mod.rs
index 17109c44..3972d9f5 100644
--- a/bitcoin/src/address/mod.rs
+++ b/bitcoin/src/address/mod.rs
@@ -387,12 +387,12 @@ internals::transparent_newtype! {
///
/// # Relevant BIPs
///
- /// * [BIP13 - Address Format for pay-to-script-hash](https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki)
- /// * [BIP16 - Pay to Script Hash](https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki)
- /// * [BIP141 - Segregated Witness (Consensus layer)](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki)
- /// * [BIP142 - Address Format for Segregated Witness](https://github.com/bitcoin/bips/blob/master/bip-0142.mediawiki)
- /// * [BIP341 - Taproot: SegWit version 1 spending rules](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki)
- /// * [BIP350 - Bech32m format for v1+ witness addresses](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki)
+ /// * [BIP-0013 - Address Format for pay-to-script-hash](https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki)
+ /// * [BIP-0016 - Pay to Script Hash](https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki)
+ /// * [BIP-0141 - Segregated Witness (Consensus layer)](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki)
+ /// * [BIP-0142 - Address Format for Segregated Witness](https://github.com/bitcoin/bips/blob/master/bip-0142.mediawiki)
+ /// * [BIP-0341 - Taproot: SegWit version 1 spending rules](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki)
+ /// * [BIP-0350 - Bech32m format for v1+ witness addresses](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki)
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
// The `#[repr(transparent)]` attribute is used to guarantee the layout of the `Address` struct. It
// is an implementation detail and users should not rely on it in their code.
@@ -502,7 +502,7 @@ impl Address {
/// Constructs a new pay-to-script-hash (P2SH) [`Address`] from a script.
///
- /// This address type was introduced with BIP16 and is the popular type to implement multi-sig
+ /// This address type was introduced with BIP-0016 and is the popular type to implement multi-sig
/// these days.
#[inline]
pub fn p2sh(
@@ -725,7 +725,7 @@ impl Address {
/// Quoting BIP 173 "inside QR codes uppercase SHOULD be used, as those permit the use of
/// alphanumeric mode, which is 45% more compact than the normal byte mode."
///
- /// Note however that despite BIP21 explicitly stating that the `bitcoin:` prefix should be
+ /// Note however that despite BIP-0021 explicitly stating that the `bitcoin:` prefix should be
/// parsed as case-insensitive many wallets got this wrong and don't parse correctly.
/// [See compatibility table.](https://github.com/btcpayserver/btcpayserver/issues/2110)
///
diff --git a/bitcoin/src/bip152.rs b/bitcoin/src/bip152.rs
index 3aa6e239..8d1a09fb 100644
--- a/bitcoin/src/bip152.rs
+++ b/bitcoin/src/bip152.rs
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: CC0-1.0
-//! BIP152 Compact Blocks.
+//! BIP-0152 Compact Blocks.
//!
//! Implementation of compact blocks data structure and algorithms.
@@ -22,7 +22,7 @@ use crate::prelude::Vec;
use crate::transaction::TxIdentifier;
use crate::{block, consensus, Block, BlockChecked, BlockHash, Transaction};
-/// A BIP-152 error
+/// A BIP-0152 error
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum Error {
@@ -91,7 +91,7 @@ impl Decodable for PrefilledTransaction {
fn consensus_decode<R: BufRead + ?Sized>(r: &mut R) -> Result<Self, encode::Error> {
let idx = r.read_compact_size()?;
let idx = u16::try_from(idx).map_err(|_| {
- consensus::parse_failed_error("BIP152 prefilled tx index out of bounds")
+ consensus::parse_failed_error("BIP-0152 prefilled tx index out of bounds")
})?;
let tx = Transaction::consensus_decode(r)?;
Ok(PrefilledTransaction { idx, tx })
@@ -246,7 +246,7 @@ impl HeaderAndShortIds {
// > Transactions inside cmpctblock messages (both those used as direct
// > announcement and those in response to getdata) and in blocktxn should
// > include witness data, using the same format as responses to getdata
- // > MSG_WITNESS_TX, specified in BIP144.
+ // > MSG_WITNESS_TX, specified in BIP-0144.
2 => tx.clone(),
_ => unreachable!(),
},
diff --git a/bitcoin/src/bip158.rs b/bitcoin/src/bip158.rs
index 6cb006cf..9360308e 100644
--- a/bitcoin/src/bip158.rs
+++ b/bitcoin/src/bip158.rs
@@ -13,8 +13,8 @@
//!
//! # Relevant BIPS
//!
-//! * [BIP 157 - Client Side Block Filtering](https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki)
-//! * [BIP 158 - Compact Block Filters for Light Clients](https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki)
+//! * [BIP-0157 - Client Side Block Filtering](https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki)
+//! * [BIP-0158 - Compact Block Filters for Light Clients](https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki)
//!
//! # Examples
//!
@@ -55,14 +55,14 @@ use crate::prelude::{BTreeSet, Borrow, Vec};
use crate::script::{Script, ScriptExt as _};
use crate::transaction::OutPoint;
-/// Golomb encoding parameter as in BIP-158, see also https://gist.github.com/sipa/576d5f09c3b86c3b1b75598d799fc845
+/// Golomb encoding parameter as in BIP-0158, see also https://gist.github.com/sipa/576d5f09c3b86c3b1b75598d799fc845
const P: u8 = 19;
const M: u64 = 784931;
hashes::hash_newtype! {
- /// Filter hash, as defined in BIP-157.
+ /// Filter hash, as defined in BIP-0157.
pub struct FilterHash(sha256d::Hash);
- /// Filter header, as defined in BIP-157.
+ /// Filter header, as defined in BIP-0157.
pub struct FilterHeader(sha256d::Hash);
}
@@ -156,7 +156,7 @@ impl BlockFilter {
/// Computes this filter's ID in a chain of filters (see [BIP 157]).
///
- /// [BIP 157]: <https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki#Filter_Headers>
+ /// [BIP-0157]: <https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki#Filter_Headers>
pub fn filter_header(&self, previous_filter_header: FilterHeader) -> FilterHeader {
FilterHash(sha256d::Hash::hash(&self.content)).filter_header(previous_filter_header)
}
diff --git a/bitcoin/src/bip32.rs b/bitcoin/src/bip32.rs
index 59930071..fa30b130 100644
--- a/bitcoin/src/bip32.rs
+++ b/bitcoin/src/bip32.rs
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: CC0-1.0
-//! BIP32 implementation.
+//! BIP-0032 implementation.
//!
-//! Implementation of BIP32 hierarchical deterministic wallets, as defined
+//! Implementation of BIP-0032 hierarchical deterministic wallets, as defined
//! at <https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki>.
use core::convert::Infallible;
@@ -56,7 +56,7 @@ internal_macros::impl_array_newtype!(Fingerprint, u8, 4);
internal_macros::impl_array_newtype_stringify!(Fingerprint, 4);
hash_newtype! {
- /// Extended key identifier as defined in BIP-32.
+ /// Extended key identifier as defined in BIP-0032.
pub struct XKeyIdentifier(hash160::Hash);
}
@@ -82,7 +82,7 @@ pub struct Xpriv {
pub chain_code: ChainCode,
}
#[cfg(feature = "serde")]
-internals::serde_string_impl!(Xpriv, "a BIP-32 extended private key");
+internals::serde_string_impl!(Xpriv, "a BIP-0032 extended private key");
#[cfg(not(feature = "std"))]
impl fmt::Debug for Xpriv {
@@ -115,7 +115,7 @@ pub struct Xpub {
pub chain_code: ChainCode,
}
#[cfg(feature = "serde")]
-internals::serde_string_impl!(Xpub, "a BIP-32 extended public key");
+internals::serde_string_impl!(Xpub, "a BIP-0032 extended public key");
/// A child number for a derived key
#[derive(Copy, Clone, PartialEq, Eq, Debug, PartialOrd, Ord, Hash)]
@@ -315,12 +315,12 @@ pub trait IntoDerivationPath {
fn into_derivation_path(self) -> Result<DerivationPath, ParseChildNumberError>;
}
-/// A BIP-32 derivation path.
+/// A BIP-0032 derivation path.
#[derive(Clone, PartialEq, Eq, Ord, PartialOrd, Hash)]
pub struct DerivationPath(Vec<ChildNumber>);
#[cfg(feature = "serde")]
-internals::serde_string_impl!(DerivationPath, "a BIP-32 derivation path");
+internals::serde_string_impl!(DerivationPath, "a BIP-0032 derivation path");
impl<I> Index<I> for DerivationPath
where
@@ -548,7 +548,7 @@ impl fmt::Debug for DerivationPath {
/// master extended public key and a derivation path from it.
pub type KeySource = (Fingerprint, DerivationPath);
-/// A BIP32 error
+/// A BIP-0032 error
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum ParseError {
@@ -586,7 +586,7 @@ impl fmt::Display for ParseError {
Base58(ref e) => write_err!(f, "base58 encoding error"; e),
InvalidBase58PayloadLength(ref e) => write_err!(f, "base58 payload"; e),
InvalidPrivateKeyPrefix =>
- f.write_str("invalid private key prefix, byte 45 must be 0 as required by BIP-32"),
+ f.write_str("invalid private key prefix, byte 45 must be 0 as required by BIP-0032"),
NonZeroParentFingerprintForMasterKey =>
f.write_str("non-zero parent fingerprint in master key"),
NonZeroChildNumberForMasterKey => f.write_str("non-zero child number in master key"),
@@ -625,7 +625,7 @@ impl From<InvalidBase58PayloadLengthError> for ParseError {
}
}
-/// A BIP32 error
+/// A BIP-0032 error
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum DerivationError {
@@ -742,11 +742,11 @@ impl Xpriv {
Xpub::from_xpriv(secp, &self)
}
- /// Constructs a new BIP340 keypair for Schnorr signatures and Taproot use matching the internal
+ /// Constructs a new BIP-0340 keypair for Schnorr signatures and Taproot use matching the internal
/// secret key representation.
pub fn to_keypair<C: secp256k1::Signing>(self, secp: &Secp256k1<C>) -> Keypair {
Keypair::from_seckey_slice(secp, &self.private_key[..])
- .expect("BIP32 internal private key representation is broken")
+ .expect("BIP-0032 internal private key representation is broken")
}
/// Derives an extended private key from a path.
@@ -815,7 +815,7 @@ impl Xpriv {
})
}
- /// Decoding extended private key from binary data according to BIP 32
+ /// Decoding extended private key from binary data according to BIP-0032
pub fn decode(data: &[u8]) -> Result<Xpriv, ParseError> {
let Common { network, depth, parent_fingerprint, child_number, chain_code, key } =
Common::decode(data)?;
@@ -841,7 +841,7 @@ impl Xpriv {
})
}
- /// Extended private key binary encoding according to BIP 32
+ /// Extended private key binary encoding according to BIP-0032
pub fn encode(&self) -> [u8; 78] {
let mut ret = [0; 78];
ret[0..4].copy_from_slice(&match self.network {
@@ -894,12 +894,12 @@ impl Xpub {
/// Constructs a new ECDSA compressed public key matching internal public key representation.
pub fn to_public_key(self) -> CompressedPublicKey { CompressedPublicKey(self.public_key) }
- /// Constructs a new BIP340 x-only public key for BIP-340 signatures and Taproot use matching
+ /// Constructs a new BIP-0340 x-only public key for BIP-0340 signatures and Taproot use matching
/// the internal public key representation.
#[deprecated(since = "TBD", note = "use `to_x_only_public_key()` instead")]
pub fn to_x_only_pub(self) -> XOnlyPublicKey { self.to_x_only_public_key() }
- /// Constructs a new BIP340 x-only public key for BIP-340 signatures and Taproot use matching
+ /// Constructs a new BIP-0340 x-only public key for BIP-0340 signatures and Taproot use matching
/// the internal public key representation.
pub fn to_x_only_public_key(self) -> XOnlyPublicKey { XOnlyPublicKey::from(self.public_key) }
@@ -973,7 +973,7 @@ impl Xpub {
})
}
- /// Decoding extended public key from binary data according to BIP 32
+ /// Decoding extended public key from binary data according to BIP-0032
pub fn decode(data: &[u8]) -> Result<Xpub, ParseError> {
let Common { network, depth, parent_fingerprint, child_number, chain_code, key } =
Common::decode(data)?;
@@ -994,7 +994,7 @@ impl Xpub {
})
}
- /// Extended public key binary encoding according to BIP 32
+ /// Extended public key binary encoding according to BIP-0032
pub fn encode(&self) -> [u8; 78] {
let mut ret = [0; 78];
ret[0..4].copy_from_slice(&match self.network {
diff --git a/bitcoin/src/blockdata/block.rs b/bitcoin/src/blockdata/block.rs
index 3e3a38b9..98d819aa 100644
--- a/bitcoin/src/blockdata/block.rs
+++ b/bitcoin/src/blockdata/block.rs
@@ -266,7 +266,7 @@ pub trait BlockCheckedExt: sealed::Sealed {
/// Returns the total block size.
///
- /// > Total size is the block size in bytes with transactions serialized as described in BIP144,
+ /// > Total size is the block size in bytes with transactions serialized as described in BIP-0144,
/// > including base data and witness data.
fn total_size(&self) -> usize;
@@ -276,7 +276,7 @@ pub trait BlockCheckedExt: sealed::Sealed {
/// that a valid coinbase transaction is always present.
fn coinbase(&self) -> &Coinbase;
- /// Returns the block height, as encoded in the coinbase transaction according to BIP34.
+ /// Returns the block height, as encoded in the coinbase transaction according to BIP-0034.
fn bip34_block_height(&self) -> Result<u64, Bip34Error>;
}
@@ -313,7 +313,7 @@ impl BlockCheckedExt for Block<Checked> {
Coinbase::assume_coinbase_ref(first_tx)
}
- /// Returns the block height, as encoded in the coinbase transaction according to BIP34.
+ /// Returns the block height, as encoded in the coinbase transaction according to BIP-0034.
fn bip34_block_height(&self) -> Result<u64, Bip34Error> {
// Citing the spec:
// Add height as the first item in the coinbase transaction's scriptSig,
@@ -442,17 +442,17 @@ impl fmt::Display for InvalidBlockError {
#[cfg(feature = "std")]
impl std::error::Error for InvalidBlockError {}
-/// An error when looking up a BIP34 block height.
+/// An error when looking up a BIP-0034 block height.
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum Bip34Error {
- /// The block does not support BIP34 yet.
+ /// The block does not support BIP-0034 yet.
Unsupported,
- /// No push was present where the BIP34 push was expected.
+ /// No push was present where the BIP-0034 push was expected.
NotPresent,
- /// The BIP34 push was not minimally encoded.
+ /// The BIP-0034 push was not minimally encoded.
NonMinimalPush,
- /// The BIP34 push was negative.
+ /// The BIP-0034 push was negative.
NegativeHeight,
}
@@ -465,10 +465,10 @@ impl fmt::Display for Bip34Error {
use Bip34Error::*;
match *self {
- Unsupported => write!(f, "block doesn't support BIP34"),
- NotPresent => write!(f, "BIP34 push not present in block's coinbase"),
+ Unsupported => write!(f, "block doesn't support BIP-0034"),
+ NotPresent => write!(f, "BIP-0034 push not present in block's coinbase"),
NonMinimalPush => write!(f, "byte push not minimally encoded"),
- NegativeHeight => write!(f, "negative BIP34 height"),
+ NegativeHeight => write!(f, "negative BIP-0034 height"),
}
}
}
@@ -909,7 +909,7 @@ mod tests {
let block: Block = deserialize(&hex!(BLOCK_HEX)).unwrap();
let block = block.assume_checked(None);
- // Test that BIP34 height extraction works with the Coinbase type
+ // Test that BIP-0034 height extraction works with the Coinbase type
assert_eq!(block.bip34_block_height(), Ok(100_000));
// Test that coinbase method returns a Coinbase type
diff --git a/bitcoin/src/blockdata/opcodes.rs b/bitcoin/src/blockdata/opcodes.rs
index 8e74c963..a5f43a43 100644
--- a/bitcoin/src/blockdata/opcodes.rs
+++ b/bitcoin/src/blockdata/opcodes.rs
@@ -337,7 +337,7 @@ all_opcodes! {
/// Classification context for the opcode.
///
/// Some opcodes like [`OP_RESERVED`] abort the script in `ClassifyContext::Legacy` context,
-/// but will act as `OP_SUCCESSx` in `ClassifyContext::TapScript` (see BIP342 for full list).
+/// but will act as `OP_SUCCESSx` in `ClassifyContext::TapScript` (see BIP-0342 for full list).
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum ClassifyContext {
/// Opcode used in tapscript context.
diff --git a/bitcoin/src/blockdata/script/borrowed.rs b/bitcoin/src/blockdata/script/borrowed.rs
index 61a0b59c..fa96aa11 100644
--- a/bitcoin/src/blockdata/script/borrowed.rs
+++ b/bitcoin/src/blockdata/script/borrowed.rs
@@ -75,9 +75,9 @@ internal_macros::define_extension_trait! {
}
/// Returns the script code used for spending a P2WPKH output if this script is a script pubkey
- /// for a P2WPKH output. The `scriptCode` is described in [BIP143].
+ /// for a P2WPKH output. The `scriptCode` is described in [BIP-0143].
///
- /// [BIP143]: <https://github.com/bitcoin/bips/blob/99701f68a88ce33b2d0838eb84e115cef505b4c2/bip-0143.mediawiki>
+ /// [BIP-0143]: <https://github.com/bitcoin/bips/blob/99701f68a88ce33b2d0838eb84e115cef505b4c2/bip-0143.mediawiki>
fn p2wpkh_script_code(&self) -> Option<ScriptBuf> {
if self.is_p2wpkh() {
// The `self` script is 0x00, 0x14, <pubkey_hash>
@@ -110,7 +110,7 @@ internal_macros::define_extension_trait! {
///
/// The witness version if this script is found to conform to the SegWit rules:
///
- /// > A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of a 1-byte
+ /// > A scriptPubKey (or redeemScript as defined in BIP-0016/P2SH) that consists of a 1-byte
/// > push opcode (for 0 to 16) followed by a data push between 2 and 40 bytes gets a new
/// > special meaning. The value of the first push is called the "version byte". The following
/// > byte vector pushed is called the "witness program".
@@ -294,7 +294,7 @@ internal_macros::define_extension_trait! {
}
}
- /// Get redeemScript following BIP16 rules regarding P2SH spending.
+ /// Get redeemScript following BIP-0016 rules regarding P2SH spending.
///
/// This does not guarantee that this represents a P2SH input [`Script`].
/// It merely gets the last push of the script.
diff --git a/bitcoin/src/blockdata/script/mod.rs b/bitcoin/src/blockdata/script/mod.rs
index c427aa34..61527106 100644
--- a/bitcoin/src/blockdata/script/mod.rs
+++ b/bitcoin/src/blockdata/script/mod.rs
@@ -92,9 +92,9 @@ impl_asref_push_bytes!(ScriptHash, WScriptHash);
/// Constructs a new [`ScriptBuf`] containing the script code used for spending a P2WPKH output.
///
-/// The `scriptCode` is described in [BIP143].
+/// The `scriptCode` is described in [BIP-0143].
///
-/// [BIP143]: <https://github.com/bitcoin/bips/blob/99701f68a88ce33b2d0838eb84e115cef505b4c2/bip-0143.mediawiki>
+/// [BIP-0143]: <https://github.com/bitcoin/bips/blob/99701f68a88ce33b2d0838eb84e115cef505b4c2/bip-0143.mediawiki>
pub fn p2wpkh_script_code(wpkh: WPubkeyHash) -> ScriptBuf {
Builder::new()
.push_opcode(OP_DUP)
diff --git a/bitcoin/src/blockdata/script/witness_program.rs b/bitcoin/src/blockdata/script/witness_program.rs
index 7ef28b84..05c5c93c 100644
--- a/bitcoin/src/blockdata/script/witness_program.rs
+++ b/bitcoin/src/blockdata/script/witness_program.rs
@@ -1,11 +1,11 @@
-//! The segregated witness program as defined by [BIP141].
+//! The segregated witness program as defined by [BIP-0141].
//!
-//! > A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of a 1-byte push
+//! > A scriptPubKey (or redeemScript as defined in BIP-0016/P2SH) that consists of a 1-byte push
//! > opcode (for 0 to 16) followed by a data push between 2 and 40 bytes gets a new special
//! > meaning. The value of the first push is called the "version byte". The following byte
//! > vector pushed is called the "witness program".
//!
-//! [BIP141]: <https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki>
+//! [BIP-0141]: <https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki>
use core::convert::Infallible;
use core::fmt;
@@ -93,7 +93,7 @@ impl WitnessProgram {
/// Constructs a new [`WitnessProgram`] from an untweaked key for a P2TR output.
///
- /// This function applies BIP341 key-tweaking to the untweaked
+ /// This function applies BIP-0341 key-tweaking to the untweaked
/// key using the merkle root, if it's present.
pub fn p2tr<C: Verification, K: Into<UntweakedPublicKey>>(
secp: &Secp256k1<C>,
diff --git a/bitcoin/src/blockdata/script/witness_version.rs b/bitcoin/src/blockdata/script/witness_version.rs
index cf987c44..1ad5b38f 100644
--- a/bitcoin/src/blockdata/script/witness_version.rs
+++ b/bitcoin/src/blockdata/script/witness_version.rs
@@ -1,11 +1,11 @@
-//! The segregated witness version byte as defined by [BIP141].
+//! The segregated witness version byte as defined by [BIP-0141].
//!
-//! > A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of a 1-byte push
+//! > A scriptPubKey (or redeemScript as defined in BIP-0016/P2SH) that consists of a 1-byte push
//! > opcode (for 0 to 16) followed by a data push between 2 and 40 bytes gets a new special
//! > meaning. The value of the first push is called the "version byte". The following byte
//! > vector pushed is called the "witness program".
//!
-//! [BIP141]: <https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki>
+//! [BIP-0141]: <https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki>
use core::convert::Infallible;
use core::fmt;
diff --git a/bitcoin/src/blockdata/transaction.rs b/bitcoin/src/blockdata/transaction.rs
index c08e2e7f..557c8223 100644
--- a/bitcoin/src/blockdata/transaction.rs
+++ b/bitcoin/src/blockdata/transaction.rs
@@ -60,9 +60,9 @@ impl TxIdentifier for Txid {}
impl TxIdentifier for Wtxid {}
// Duplicated in `primitives`.
-/// The marker MUST be a 1-byte zero value: 0x00. (BIP-141)
+/// The marker MUST be a 1-byte zero value: 0x00. (BIP-0141)
const SEGWIT_MARKER: u8 = 0x00;
-/// The flag MUST be a 1-byte non-zero value. Currently, 0x01 MUST be used. (BIP-141)
+/// The flag MUST be a 1-byte non-zero value. Currently, 0x01 MUST be used. (BIP-0141)
const SEGWIT_FLAG: u8 = 0x01;
internal_macros::define_extension_trait! {
@@ -99,7 +99,7 @@ internal_macros::define_extension_trait! {
/// ignored. If this returns false and OP_CHECKLOCKTIMEVERIFY is used in the redeem script with
/// this input then the script execution will fail [BIP-0065].
///
- /// [BIP-65](https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki)
+ /// [BIP-0065](https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki)
fn enables_lock_time(&self) -> bool { self.sequence != Sequence::MAX }
/// The weight of the TxIn when it's included in a legacy transaction (i.e., a transaction
@@ -224,7 +224,7 @@ pub trait TransactionExt: sealed::Sealed {
#[deprecated(since = "0.31.0", note = "use `compute_wtxid()` instead")]
fn wtxid(&self) -> Wtxid;
- /// Returns the weight of this transaction, as defined by BIP-141.
+ /// Returns the weight of this transaction, as defined by BIP-0141.
///
/// > Transaction weight is defined as Base transaction size * 3 + Total transaction size (ie.
/// > the same method as calculating Block weight from Base size and Total size).
@@ -236,7 +236,7 @@ pub trait TransactionExt: sealed::Sealed {
/// For transactions with no inputs, this function will return a value 2 less than the actual
/// weight of the serialized transaction. The reason is that zero-input transactions, post-SegWit,
/// cannot be unambiguously serialized; we make a choice that adds two extra bytes. For more
- /// details see [BIP 141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki)
+ /// details see [BIP-0141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki)
/// which uses a "input count" of `0x00` as a `marker` for a SegWit-encoded transaction.
///
/// If you need to use 0-input transactions, we strongly recommend you do so using the PSBT
@@ -251,20 +251,20 @@ pub trait TransactionExt: sealed::Sealed {
/// Returns the total transaction size.
///
- /// > Total transaction size is the transaction size in bytes serialized as described in BIP144,
+ /// > Total transaction size is the transaction size in bytes serialized as described in BIP-0144,
/// > including base data and witness data.
fn total_size(&self) -> usize;
/// Returns the "virtual size" (vsize) of this transaction.
///
- /// Will be `ceil(weight / 4.0)`. Note this implements the virtual size as per [`BIP141`], which
+ /// Will be `ceil(weight / 4.0)`. Note this implements the virtual size as per [`BIP-0141`], which
/// is different to what is implemented in Bitcoin Core. The computation should be the same for
/// any remotely sane transaction, and a standardness-rule-correct version is available in the
/// [`policy`] module.
///
/// > Virtual transaction size is defined as Transaction weight / 4 (rounded up to the next integer).
///
- /// [`BIP141`]: https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki
+ /// [`BIP-0141`]: https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki
/// [`policy`]: crate::policy
fn vsize(&self) -> usize;
@@ -277,7 +277,7 @@ pub trait TransactionExt: sealed::Sealed {
#[doc(alias = "is_coin_base")] // method previously had this name
fn is_coinbase(&self) -> bool;
- /// Returns `true` if the transaction itself opted in to be BIP-125-replaceable (RBF).
+ /// Returns `true` if the transaction itself opted in to be BIP-0125-replaceable (RBF).
///
/// # Warning
///
@@ -297,9 +297,9 @@ pub trait TransactionExt: sealed::Sealed {
/// transaction from being mined immediately.
fn is_absolute_timelock_satisfied(&self, height: Height, time: MedianTimePast) -> bool;
- /// Returns `true` if this transactions nLockTime is enabled ([BIP-65]).
+ /// Returns `true` if this transactions nLockTime is enabled ([BIP-0065]).
///
- /// [BIP-65]: https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki
+ /// [BIP-0065]: https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki
fn is_lock_time_enabled(&self) -> bool;
/// Returns an iterator over lengths of `script_pubkey`s in the outputs.
@@ -558,7 +558,7 @@ impl TransactionExtPriv for Transaction {
if self.inputs.iter().any(|input| !input.witness.is_empty()) {
return true;
}
- // To avoid serialization ambiguity, no inputs means we use BIP141 serialization (see
+ // To avoid serialization ambiguity, no inputs means we use BIP-0141 serialization (see
// `Transaction` docs for full explanation).
self.inputs.is_empty()
}
@@ -721,7 +721,7 @@ impl Decodable for Transaction {
if inputs.is_empty() {
let segwit_flag = u8::consensus_decode_from_finite_reader(r)?;
match segwit_flag {
- // BIP144 input witnesses
+ // BIP-0144 input witnesses
1 => {
let mut inputs = Vec::<TxIn>::consensus_decode_from_finite_reader(r)?;
let outputs = Vec::<TxOut>::consensus_decode_from_finite_reader(r)?;
diff --git a/bitcoin/src/blockdata/witness.rs b/bitcoin/src/blockdata/witness.rs
index dcc7718f..d1d2112b 100644
--- a/bitcoin/src/blockdata/witness.rs
+++ b/bitcoin/src/blockdata/witness.rs
@@ -250,7 +250,7 @@ impl<'a> P2TrSpend<'a> {
/// obtained from Bitcoin Core) then it's OK to unwrap this but not vice versa - `Some` does
/// not imply correctness.
fn from_witness(witness: &'a Witness) -> Option<Self> {
- // BIP341 says:
+ // BIP-0341 says:
// If there are at least two witness elements, and the first byte of
// the last element is 0x50, this last element is called annex a
// and is removed from the witness stack.
diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs
index c2267c80..9a706347 100644
--- a/bitcoin/src/crypto/key.rs
+++ b/bitcoin/src/crypto/key.rs
@@ -30,7 +30,7 @@ pub use secp256k1::{constants, Keypair, Parity, Secp256k1, Verification};
pub use secp256k1::rand;
pub use serialized_x_only::SerializedXOnlyPublicKey;
-/// A Bitcoin Schnorr X-only public key used for BIP340 signatures.
+/// A Bitcoin Schnorr X-only public key used for BIP-0340 signatures.
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct XOnlyPublicKey(secp256k1::XOnlyPublicKey);
@@ -243,7 +243,7 @@ impl PublicKey {
///
/// If every `PublicKey` in the slice is `compressed == true` then this will sort
/// the keys in a
- /// [BIP67](https://github.com/bitcoin/bips/blob/master/bip-0067.mediawiki)
+ /// [BIP-0067](https://github.com/bitcoin/bips/blob/master/bip-0067.mediawiki)
/// compliant way.
///
/// # Example: Using with `sort_unstable_by_key`
@@ -263,13 +263,13 @@ impl PublicKey {
/// pk("0234dd69c56c36a41230d573d68adeae0030c9bc0bf26f24d3e1b64c604d293c68"),
/// ];
/// let sorted = [
- /// // These first 4 keys are in a BIP67 compatible sorted order
+ /// // These first 4 keys are in a BIP-0067 compatible sorted order
/// // (since they are compressed)
/// pk("0234dd69c56c36a41230d573d68adeae0030c9bc0bf26f24d3e1b64c604d293c68"),
/// pk("028bde91b10013e08949a318018fedbd896534a549a278e220169ee2a36517c7aa"),
/// pk("032b8324c93575034047a52e9bca05a46d8347046b91a032eff07d5de8d3f2730b"),
/// pk("038f47dcd43ba6d97fc9ed2e3bba09b175a45fac55f0683e8cf771e8ced4572354"),
- /// // Uncompressed keys are not BIP67 compliant, but are sorted
+ /// // Uncompressed keys are not BIP-0067 compliant, but are sorted
/// // after compressed keys in Bitcoin Core using `sortedmulti()`
/// pk("045d753414fa292ea5b8f56e39cfb6a0287b2546231a5cb05c4b14ab4b463d171f5128148985b23eccb1e2905374873b1f09b9487f47afa6b1f2b0083ac8b4f7e8"),
/// pk("04c4b0bbb339aa236bff38dbe6a451e111972a7909a126bc424013cba2ec33bc3816753d96001fd7cba3ce5372f5c9a0d63708183033538d07b1e532fc43aaacfa"),
@@ -436,7 +436,7 @@ impl CompressedPublicKey {
///
/// As the type name suggests, the key is serialized in compressed format.
///
- /// Note that this can be used as a sort key to get BIP67-compliant sorting.
+ /// Note that this can be used as a sort key to get BIP-0067-compliant sorting.
/// That's why this type doesn't have the `to_sort_key` method - it would duplicate this one.
pub fn to_bytes(self) -> [u8; 33] { self.0.serialize() }
@@ -643,7 +643,7 @@ impl PrivateKey {
///
/// The resulting key corresponds to the same x-only public key (identical x-coordinate)
/// but with the opposite y-coordinate parity. This is useful for ensuring compatibility
- /// with specific public key formats and BIP-340 requirements.
+ /// with specific public key formats and BIP-0340 requirements.
#[inline]
pub fn negate(&self) -> Self {
PrivateKey {
@@ -842,10 +842,10 @@ impl<'de> serde::Deserialize<'de> for CompressedPublicKey {
}
}
}
-/// Untweaked BIP-340 X-coord-only public key.
+/// Untweaked BIP-0340 X-coord-only public key.
pub type UntweakedPublicKey = XOnlyPublicKey;
-/// Tweaked BIP-340 X-coord-only public key.
+/// Tweaked BIP-0340 X-coord-only public key.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
@@ -861,10 +861,10 @@ impl fmt::Display for TweakedPublicKey {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(&self.0, f) }
}
-/// Untweaked BIP-340 key pair.
+/// Untweaked BIP-0340 key pair.
pub type UntweakedKeypair = Keypair;
-/// Tweaked BIP-340 key pair.
+/// Tweaked BIP-0340 key pair.
///
/// # Examples
///
@@ -885,7 +885,7 @@ pub type UntweakedKeypair = Keypair;
#[cfg_attr(feature = "serde", serde(transparent))]
pub struct TweakedKeypair(Keypair);
-/// A trait for tweaking BIP340 key types (x-only public keys and key pairs).
+/// A trait for tweaking BIP-0340 key types (x-only public keys and key pairs).
pub trait TapTweak {
/// Tweaked key type with optional auxiliary information.
type TweakedAux;
@@ -1645,7 +1645,7 @@ mod tests {
v.into_iter().map(|s: &str| s.parse::<PublicKey>().unwrap()).collect::<Vec<_>>()
};
let vectors = vec,
-//! [Bip143](https://github.com/bitcoin/bips/blob/99701f68a88ce33b2d0838eb84e115cef505b4c2/bip-0143.mediawiki)
-//! and legacy (before Bip143).
+//! [BIP-0341](https://github.com/bitcoin/bips/blob/150ab6f5c3aca9da05fccc5b435e9667853407f4/bip-0341.mediawiki),
+//! [BIP-0143](https://github.com/bitcoin/bips/blob/99701f68a88ce33b2d0838eb84e115cef505b4c2/bip-0143.mediawiki)
+//! and legacy (before BIP-0143).
//!
//! Computing signature hashes is required to sign a transaction and this module is designed to
//! handle its complexity efficiently. Computing these hashes is as simple as creating
@@ -610,7 +610,7 @@ impl<R: Borrow<Transaction>> SighashCache<R> {
/// Destroys the cache and recovers the stored transaction.
pub fn into_transaction(self) -> R { self.tx }
- /// Encodes the BIP341 signing data for any flag type into a given object implementing the
+ /// Encodes the BIP-0341 signing data for any flag type into a given object implementing the
/// [`io::Write`] trait.
///
/// In order to sign, the data written by this function must be hashed using a tagged hash. For
@@ -735,7 +735,7 @@ impl<R: Borrow<Transaction>> SighashCache<R> {
Ok(())
}
- /// Computes the BIP341 sighash for any flag type.
+ /// Computes the BIP-0341 sighash for any flag type.
pub fn taproot_signature_hash<T: Borrow<TxOut>>(
&mut self,
input_index: usize,
@@ -758,7 +758,7 @@ impl<R: Borrow<Transaction>> SighashCache<R> {
Ok(TapSighash::from_byte_array(inner.to_byte_array()))
}
- /// Computes the BIP341 sighash for a key spend.
+ /// Computes the BIP-0341 sighash for a key spend.
pub fn taproot_key_spend_signature_hash<T: Borrow<TxOut>>(
&mut self,
input_index: usize,
@@ -779,7 +779,7 @@ impl<R: Borrow<Transaction>> SighashCache<R> {
Ok(TapSighash::from_byte_array(inner.to_byte_array()))
}
- /// Computes the BIP341 sighash for a script spend.
+ /// Computes the BIP-0341 sighash for a script spend.
///
/// Assumes the default `OP_CODESEPARATOR` position of `0xFFFFFFFF`. Custom values can be
/// provided through the more fine-grained API of [`SighashCache::taproot_encode_signing_data_to`].
@@ -804,7 +804,7 @@ impl<R: Borrow<Transaction>> SighashCache<R> {
Ok(TapSighash::from_byte_array(inner.to_byte_array()))
}
- /// Encodes the BIP143 signing data for any flag type into a given object implementing the
+ /// Encodes the BIP-0143 signing data for any flag type into a given object implementing the
/// [`std::io::Write`] trait.
///
/// `script_code` is dependent on the type of the spend transaction. For p2wpkh use
@@ -868,7 +868,7 @@ impl<R: Borrow<Transaction>> SighashCache<R> {
Ok(())
}
- /// Computes the BIP143 sighash to spend a p2wpkh transaction for any flag type.
+ /// Computes the BIP-0143 sighash to spend a p2wpkh transaction for any flag type.
///
/// `script_pubkey` is the `scriptPubkey` (native SegWit) of the spend transaction
/// ([`TxOut::script_pubkey`]) or the `redeemScript` (wrapped SegWit).
@@ -893,7 +893,7 @@ impl<R: Borrow<Transaction>> SighashCache<R> {
Ok(SegwitV0Sighash::from_engine(enc))
}
- /// Computes the BIP143 sighash to spend a p2wsh transaction for any flag type.
+ /// Computes the BIP-0143 sighash to spend a p2wsh transaction for any flag type.
///
/// `witness_script` is the script that goes into the [`Witness`],
/// not the one that goes into `script_pubkey` of a [`TxOut`].
@@ -2104,7 +2104,7 @@ mod tests {
);
let cache = cache.segwit_cache();
- // Parse hex into Vec because BIP143 test vector displays forwards but our sha256d::Hash displays backwards.
+ // Parse hex into Vec because BIP-0143 test vector displays forwards but our sha256d::Hash displays backwards.
assert_eq!(
cache.prevouts.as_byte_array(),
&Vec::from_hex("96b827c8483d4e9b96712b6713a7b68d6e8003a781feba36c31143470b4efd37")
@@ -2146,7 +2146,7 @@ mod tests {
);
let cache = cache.segwit_cache();
- // Parse hex into Vec because BIP143 test vector displays forwards but our sha256d::Hash displays backwards.
+ // Parse hex into Vec because BIP-0143 test vector displays forwards but our sha256d::Hash displays backwards.
assert_eq!(
cache.prevouts.as_byte_array(),
&Vec::from_hex("b0287b4a252ac05af83d2dcef00ba313af78a3e9c329afa216eb3aa2a7b4613a")
@@ -2164,7 +2164,7 @@ mod tests {
);
}
- // Note, if you are looking at the test vectors in BIP-143 and wondering why there is a `cf`
+ // Note, if you are looking at the test vectors in BIP-0143 and wondering why there is a `cf`
// prepended to all the script_code hex it is the length byte, it gets added when we consensus
// encode a script.
fn bip143_p2wsh_nested_in_p2sh_data() -> (Transaction, ScriptBuf, Amount) {
@@ -2206,7 +2206,7 @@ mod tests {
// sighash for all sighash types.
let cache = cache.segwit_cache();
- // Parse hex into Vec because BIP143 test vector displays forwards but our sha256d::Hash displays backwards.
+ // Parse hex into Vec because BIP-0143 test vector displays forwards but our sha256d::Hash displays backwards.
assert_eq!(
cache.prevouts.as_byte_array(),
&Vec::from_hex("74afdc312af5183c4198a40ca3c1a275b485496dd3929bca388c4b5e31f7aaa0")
diff --git a/bitcoin/src/crypto/taproot.rs b/bitcoin/src/crypto/taproot.rs
index e8dfa2ee..87f18a8a 100644
--- a/bitcoin/src/crypto/taproot.rs
+++ b/bitcoin/src/crypto/taproot.rs
@@ -17,7 +17,7 @@ use crate::prelude::Vec;
use crate::sighash::{InvalidSighashTypeError, TapSighashType};
use crate::taproot::serialized_signature::{self, SerializedSignature};
-/// A BIP340-341 serialized Taproot signature with the corresponding hash type.
+/// A BIP-0340-0341 serialized Taproot signature with the corresponding hash type.
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Signature {
diff --git a/bitcoin/src/network/params.rs b/bitcoin/src/network/params.rs
index cda3b452..69a136ed 100644
--- a/bitcoin/src/network/params.rs
+++ b/bitcoin/src/network/params.rs
@@ -72,16 +72,16 @@ use crate::{BlockHeight, BlockHeightInterval};
pub struct Params {
/// Network for which parameters are valid.
pub network: Network,
- /// Time when BIP16 becomes active.
+ /// Time when BIP-0016 becomes active.
pub bip16_time: u32,
- /// Block height at which BIP34 becomes active.
+ /// Block height at which BIP-0034 becomes active.
pub bip34_height: BlockHeight,
- /// Block height at which BIP65 becomes active.
+ /// Block height at which BIP-0065 becomes active.
pub bip65_height: BlockHeight,
- /// Block height at which BIP66 becomes active.
+ /// Block height at which BIP-0066 becomes active.
pub bip66_height: BlockHeight,
/// Minimum blocks including miner confirmation of the total of 2016 blocks in a retargeting period,
- /// (nPowTargetTimespan / nPowTargetSpacing) which is also used for BIP9 deployments.
+ /// (nPowTargetTimespan / nPowTargetSpacing) which is also used for BIP-0009 deployments.
/// Examples: 1916 for 95%, 1512 for testchains.
pub rule_change_activation_threshold: BlockHeightInterval,
/// Number of blocks with the same set of rules.
diff --git a/bitcoin/src/psbt/map/global.rs b/bitcoin/src/psbt/map/global.rs
index f3ca7b24..2e277d34 100644
--- a/bitcoin/src/psbt/map/global.rs
+++ b/bitcoin/src/psbt/map/global.rs
@@ -135,7 +135,7 @@ impl Psbt {
path.push(ChildNumber::from(index))
}
let derivation = DerivationPath::from(path);
- // Keys, according to BIP-174, must be unique
+ // Keys, according to BIP-0174, must be unique
if xpub_map
.insert(xpub, (Fingerprint::from(fingerprint), derivation))
.is_some()
@@ -161,7 +161,7 @@ impl Psbt {
));
}
version = Some(Decodable::consensus_decode(&mut decoder)?);
- // We only understand version 0 PSBTs. According to BIP-174 we
+ // We only understand version 0 PSBTs. According to BIP-0174 we
// should throw an error if we see anything other than version 0.
if version != Some(0) {
return Err(Error::Version(
diff --git a/bitcoin/src/psbt/map/input.rs b/bitcoin/src/psbt/map/input.rs
index 2422c57d..3a6a066e 100644
--- a/bitcoin/src/psbt/map/input.rs
+++ b/bitcoin/src/psbt/map/input.rs
@@ -33,7 +33,7 @@ const PSBT_IN_SIGHASH_TYPE: u64 = 0x03;
const PSBT_IN_REDEEM_SCRIPT: u64 = 0x04;
/// Type: Witness Script PSBT_IN_WITNESS_SCRIPT = 0x05
const PSBT_IN_WITNESS_SCRIPT: u64 = 0x05;
-/// Type: BIP 32 Derivation Path PSBT_IN_BIP32_DERIVATION = 0x06
+/// Type: BIP-0032 Derivation Path PSBT_IN_BIP32_DERIVATION = 0x06
const PSBT_IN_BIP32_DERIVATION: u64 = 0x06;
/// Type: Finalized scriptSig PSBT_IN_FINAL_SCRIPTSIG = 0x07
const PSBT_IN_FINAL_SCRIPTSIG: u64 = 0x07;
@@ -53,7 +53,7 @@ const PSBT_IN_TAP_KEY_SIG: u64 = 0x13;
const PSBT_IN_TAP_SCRIPT_SIG: u64 = 0x14;
/// Type: Taproot Leaf Script PSBT_IN_TAP_LEAF_SCRIPT = 0x14
const PSBT_IN_TAP_LEAF_SCRIPT: u64 = 0x15;
-/// Type: Taproot Key BIP 32 Derivation Path PSBT_IN_TAP_BIP32_DERIVATION = 0x16
+/// Type: Taproot Key BIP-0032 Derivation Path PSBT_IN_TAP_BIP32_DERIVATION = 0x16
const PSBT_IN_TAP_BIP32_DERIVATION: u64 = 0x16;
/// Type: Taproot Internal Key PSBT_IN_TAP_INTERNAL_KEY = 0x17
const PSBT_IN_TAP_INTERNAL_KEY: u64 = 0x17;
diff --git a/bitcoin/src/psbt/map/mod.rs b/bitcoin/src/psbt/map/mod.rs
index b086a3e9..58c28699 100644
--- a/bitcoin/src/psbt/map/mod.rs
+++ b/bitcoin/src/psbt/map/mod.rs
@@ -20,7 +20,7 @@ pub(super) trait Map {
/// Attempt to get all key-value pairs.
fn get_pairs(&self) -> Vec<raw::Pair>;
- /// Serialize Psbt binary map data according to BIP-174 specification.
+ /// Serialize Psbt binary map data according to BIP-0174 specification.
///
/// <map> := <keypair>* 0x00
///
diff --git a/bitcoin/src/psbt/map/output.rs b/bitcoin/src/psbt/map/output.rs
index 37e853f8..db1e2eeb 100644
--- a/bitcoin/src/psbt/map/output.rs
+++ b/bitcoin/src/psbt/map/output.rs
@@ -12,13 +12,13 @@ use crate::taproot::{TapLeafHash, TapTree};
const PSBT_OUT_REDEEM_SCRIPT: u64 = 0x00;
/// Type: Witness ScriptBuf PSBT_OUT_WITNESS_SCRIPT = 0x01
const PSBT_OUT_WITNESS_SCRIPT: u64 = 0x01;
-/// Type: BIP 32 Derivation Path PSBT_OUT_BIP32_DERIVATION = 0x02
+/// Type: BIP-0032 Derivation Path PSBT_OUT_BIP32_DERIVATION = 0x02
const PSBT_OUT_BIP32_DERIVATION: u64 = 0x02;
/// Type: Taproot Internal Key PSBT_OUT_TAP_INTERNAL_KEY = 0x05
const PSBT_OUT_TAP_INTERNAL_KEY: u64 = 0x05;
/// Type: Taproot Tree PSBT_OUT_TAP_TREE = 0x06
const PSBT_OUT_TAP_TREE: u64 = 0x06;
-/// Type: Taproot Key BIP 32 Derivation Path PSBT_OUT_TAP_BIP32_DERIVATION = 0x07
+/// Type: Taproot Key BIP-0032 Derivation Path PSBT_OUT_TAP_BIP32_DERIVATION = 0x07
const PSBT_OUT_TAP_BIP32_DERIVATION: u64 = 0x07;
/// Type: MuSig2 Public Keys Participating in Aggregate Output PSBT_OUT_MUSIG2_PARTICIPANT_PUBKEYS = 0x08
const PSBT_OUT_MUSIG2_PARTICIPANT_PUBKEYS: u64 = 0x08;
diff --git a/bitcoin/src/psbt/mod.rs b/bitcoin/src/psbt/mod.rs
index 3ba09f28..422f8dac 100644
--- a/bitcoin/src/psbt/mod.rs
+++ b/bitcoin/src/psbt/mod.rs
@@ -2,7 +2,7 @@
//! Partially Signed Bitcoin Transactions.
//!
-//! Implementation of BIP174 Partially Signed Bitcoin Transaction Format as
+//! Implementation of BIP-0174 Partially Signed Bitcoin Transaction Format as
//! defined at <https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki>
//! except we define PSBTs containing non-standard sighash types as invalid.
@@ -213,9 +213,9 @@ impl Psbt {
}
}
- /// Combines this [`Psbt`] with `other` PSBT as described by BIP 174.
+ /// Combines this [`Psbt`] with `other` PSBT as described by BIP-0174.
///
- /// In accordance with BIP 174 this function is commutative i.e., `A.combine(B) == B.combine(A)`
+ /// In accordance with BIP-0174 this function is commutative i.e., `A.combine(B) == B.combine(A)`
pub fn combine(&mut self, other: Self) -> Result<(), Error> {
if self.unsigned_tx != other.unsigned_tx {
return Err(Error::UnexpectedUnsignedTx {
@@ -224,7 +224,7 @@ impl Psbt {
});
}
- // BIP 174: The Combiner must remove any duplicate key-value pairs, in accordance with
+ // BIP-0174: The Combiner must remove any duplicate key-value pairs, in accordance with
// the specification. It can pick arbitrarily when conflicts occur.
// Keeping the highest version
@@ -434,10 +434,10 @@ impl Psbt {
// key path spend
if let Some(internal_key) = input.tap_internal_key {
- // BIP 371: The internal key does not have leaf hashes, so can be indicated with a hashes len of 0.
+ // BIP-0371: The internal key does not have leaf hashes, so can be indicated with a hashes len of 0.
// Based on input.tap_internal_key.is_some() alone, it is not sufficient to determine whether it is a key path spend.
- // According to BIP 371, we also need to consider the condition leaf_hashes.is_empty() for a more accurate determination.
+ // According to BIP-0371, we also need to consider the condition leaf_hashes.is_empty() for a more accurate determination.
if internal_key == xonly && leaf_hashes.is_empty() && input.tap_key_sig.is_none() {
let (msg, sighash_type) = self.sighash_taproot(input_index, cache, None)?;
let key_pair = Keypair::from_secret_key(secp, &sk.inner)
@@ -776,7 +776,7 @@ impl<'de> serde::Deserialize<'de> for Psbt {
pub enum KeyRequest {
/// Request a private key using the associated public key.
Pubkey(PublicKey),
- /// Request a private key using BIP-32 fingerprint and derivation path.
+ /// Request a private key using BIP-0032 fingerprint and derivation path.
Bip32(KeySource),
/// Request a private key using the associated x-only public key.
XOnlyPubkey(XOnlyPublicKey),
@@ -2258,7 +2258,7 @@ mod tests {
assert!(!rtt.proprietary.is_empty());
}
- // Deserialize MuSig2 PSBT participant keys according to BIP-373
+ // Deserialize MuSig2 PSBT participant keys according to BIP-0373
#[test]
fn serialize_and_deserialize_musig2_participants() {
// XXX: Does not cover PSBT_IN_MUSIG2_PUB_NONCE, PSBT_IN_MUSIG2_PARTIAL_SIG (yet)
diff --git a/bitcoin/src/psbt/serialize.rs b/bitcoin/src/psbt/serialize.rs
index 7eec8f00..f1c89ad1 100644
--- a/bitcoin/src/psbt/serialize.rs
+++ b/bitcoin/src/psbt/serialize.rs
@@ -3,7 +3,7 @@
//! PSBT serialization.
//!
//! Traits to serialize PSBT values to and from raw bytes
-//! according to the BIP-174 specification.
+//! according to the BIP-0174 specification.
use hashes::{hash160, ripemd160, sha256, sha256d};
use internals::compact_size;
@@ -212,7 +212,7 @@ impl Serialize for ecdsa::Signature {
impl Deserialize for ecdsa::Signature {
fn deserialize(bytes: &[u8]) -> Result<Self, Error> {
- // NB: Since BIP-174 says "the signature as would be pushed to the stack from
+ // NB: Since BIP-0174 says "the signature as would be pushed to the stack from
// a scriptSig or witness" we should ideally use a consensus deserialization and do
// not error on a non-standard values. However,
//
@@ -222,7 +222,7 @@ impl Deserialize for ecdsa::Signature {
// EcdsaSig::from_slice(&sl[..]).to_vec = sl.
//
// 2) This would cause to have invalid signatures because the sighash message
- // also has a field sighash_u32 (See BIP141). For example, when signing with non-standard
+ // also has a field sighash_u32 (See BIP-0141). For example, when signing with non-standard
// 0x05, the sighash message would have the last field as 0x05u32 while, the verification
// would use check the signature assuming sighash_u32 as `0x01`.
ecdsa::Signature::from_slice(bytes).map_err(|e| match e {
diff --git a/bitcoin/src/taproot/mod.rs b/bitcoin/src/taproot/mod.rs
index ffeadf88..4036189c 100644
--- a/bitcoin/src/taproot/mod.rs
+++ b/bitcoin/src/taproot/mod.rs
@@ -43,7 +43,7 @@ pub use crate::XOnlyPublicKey;
type ControlBlockArrayVec = internals::array_vec::ArrayVec<u8, TAPROOT_CONTROL_MAX_SIZE>;
-// Taproot test vectors from BIP-341 state the hashes without any reversing
+// Taproot test vectors from BIP-0341 state the hashes without any reversing
sha256t_tag! {
pub struct TapLeafTag = hash_str("TapLeaf");
}
@@ -66,7 +66,7 @@ sha256t_tag! {
hash_newtype! {
/// Tagged hash used in Taproot trees.
///
- /// See BIP-340 for tagging rules.
+ /// See BIP-0340 for tagging rules.
#[repr(transparent)]
pub struct TapNodeHash(sha256t::Hash<TapBranchTag>);
}
@@ -95,7 +95,7 @@ impl From<TapLeafHash> for TapNodeHash {
}
impl TapTweakHash {
- /// Constructs a new BIP341 [`TapTweakHash`] from key and Merkle root. Produces `H_taptweak(P||R)` where
+ /// Constructs a new BIP-0341 [`TapTweakHash`] from key and Merkle root. Produces `H_taptweak(P||R)` where
/// `P` is the internal key and `R` is the Merkle root.
pub fn from_key_and_merkle_root<K: Into<UntweakedPublicKey>>(
internal_key: K,
@@ -222,14 +222,14 @@ type ScriptMerkleProofMap = BTreeMap<(ScriptBuf, LeafVersion), BTreeSet<TaprootM
///
/// If one or more of the spending conditions consist of just a single key (after aggregation), the
/// most likely key should be made the internal key.
-/// See [BIP341](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki) for more details on
+/// See [BIP-0341](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki) for more details on
/// choosing internal keys for a Taproot application.
///
/// Note: This library currently does not support
/// [annex](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#cite_note-5).
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct TaprootSpendInfo {
- /// The BIP341 internal key.
+ /// The BIP-0341 internal key.
internal_key: UntweakedPublicKey,
/// The Merkle root of the script tree (None if there are no scripts).
merkle_root: Option<TapNodeHash>,
@@ -266,7 +266,7 @@ impl TaprootSpendInfo {
/// Constructs a new key spend with `internal_key` and `merkle_root`. Provide [`None`] for
/// the `merkle_root` if there is no script path.
///
- /// *Note*: As per BIP341
+ /// *Note*: As per BIP-0341
///
/// When the Merkle root is [`None`], the output key commits to an unspendable script path
/// instead of having no script path. This is achieved by computing the output key point as
@@ -757,7 +757,7 @@ impl std::error::Error for HiddenNodesError {
/// This is in contrast to [`NodeInfo`], which allows hidden nodes.
/// The implementations for Eq, PartialEq and Hash compare the Merkle root of the tree
//
-// This is a bug in BIP370 that does not specify how to share trees with hidden nodes,
+// This is a bug in BIP-0370 that does not specify how to share trees with hidden nodes,
// for which we need a separate type.
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
@@ -1358,7 +1358,7 @@ impl fmt::UpperHex for FutureLeafVersion {
/// The leaf version for tapleafs.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum LeafVersion {
- /// BIP-342 tapscript.
+ /// BIP-0342 tapscript.
TapScript,
/// Future leaf version.
diff --git a/chacha20_poly1305/src/chacha20.rs b/chacha20_poly1305/src/chacha20.rs
index d2b3b95d..b9388923 100644
--- a/chacha20_poly1305/src/chacha20.rs
+++ b/chacha20_poly1305/src/chacha20.rs
@@ -251,7 +251,7 @@ impl State {
/// The ChaCha20 stream cipher from RFC8439.
///
/// The 20-round IETF version uses a 96-bit nonce and 32-bit block counter. This is the
-/// variant used in the Bitcoin ecosystem, including BIP324.
+/// variant used in the Bitcoin ecosystem, including BIP-0324.
pub struct ChaCha20 {
/// Secret key shared by the parties communicating.
key: Key,
diff --git a/docs/policy.md b/docs/policy.md
index f38a50a9..5bed708a 100644
--- a/docs/policy.md
+++ b/docs/policy.md
@@ -191,7 +191,7 @@ hacking on this codebase. Consider the following format, not all sections will b
///
/// ### Relevant BIPs
///
-/// * [BIP X - FooBar in Bitcoin](https://github.com/bitcoin/bips/blob/master/bip-0001.mediawiki)
+/// * [BIP-XXXX - FooBar in Bitcoin](https://github.com/bitcoin/bips/blob/master/bip-xxxx.mediawiki)
pub struct FooBar {
/// The version in use.
pub version: Version
@@ -257,6 +257,21 @@ See [Errors](#errors) section.
version attributes may be added as needed.
+## BIP References
+
+When referring to Bitcoin Improvement Proposals (BIPs) in documentation, comments, and error messages, use the standardized notation `BIP-XXXX` where `XXXX` is the 4-digit BIP number with leading zeros.
+
+### Examples
+
+- Correct: `BIP-0032`, `BIP-0341`, `BIP-0014`
+- Incorrect: `BIP32`, `BIP 341`, `Bip14`, `bip_341`
+
+### Exceptions
+
+Module names, function names, variable names, and file names must keep their existing lowercase/underscore format. Do not rename them to match the formal BIP style:
+- Module names: `bip32`, `bip152` (keep lowercase)
+- Function names: `bip32_derivation`, `bip_341_tests` (keep existing format)
+
## Licensing
We use SPDX license tags, all files should start with
diff --git a/hashes/src/hkdf/mod.rs b/hashes/src/hkdf/mod.rs
index c381422d..30a80362 100644
--- a/hashes/src/hkdf/mod.rs
+++ b/hashes/src/hkdf/mod.rs
@@ -3,7 +3,7 @@
//! HMAC-based Extract-and-Expand Key Derivation Function (HKDF).
//!
//! Implementation based on RFC5869, but the interface is scoped
-//! to BIP324's requirements.
+//! to BIP-0324's requirements.
#[cfg(feature = "alloc")]
use alloc::vec;
diff --git a/p2p/src/address.rs b/p2p/src/address.rs
index c8bfe18a..4047814a 100644
--- a/p2p/src/address.rs
+++ b/p2p/src/address.rs
@@ -128,7 +128,7 @@ impl ToSocketAddrs for Address {
}
}
-/// Supported networks for use in BIP155 addrv2 message
+/// Supported networks for use in BIP-0155 addrv2 message
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub enum AddrV2 {
/// IPV4
@@ -300,7 +300,7 @@ impl Decodable for AddrV2 {
}
}
-/// Address received from BIP155 addrv2 message
+/// Address received from BIP-0155 addrv2 message
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct AddrV2Message {
/// Time that this node was last seen as connected to the network
diff --git a/p2p/src/lib.rs b/p2p/src/lib.rs
index 09e8cc0e..666c0b8b 100644
--- a/p2p/src/lib.rs
+++ b/p2p/src/lib.rs
@@ -130,7 +130,7 @@ impl ServiceFlags {
/// GETUTXO means the node is capable of responding to the getutxo protocol request. Bitcoin
/// Core does not support this but a patch set called Bitcoin XT does.
- /// See BIP 64 for details on how this is implemented.
+ /// See BIP-0064 for details on how this is implemented.
pub const GETUTXO: ServiceFlags = ServiceFlags(1 << 1);
/// BLOOM means the node is capable and willing to handle bloom-filtered connections. Bitcoin
@@ -143,16 +143,16 @@ impl ServiceFlags {
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.
+ /// See BIP-0157 and BIP-0158 for details on how this is implemented.
pub const COMPACT_FILTERS: ServiceFlags = ServiceFlags(1 << 6);
/// NETWORK_LIMITED means the same as NODE_NETWORK with the limitation of only serving the last
/// 288 (2 day) blocks.
- /// See BIP159 for details on how this is implemented.
+ /// See BIP-0159 for details on how this is implemented.
pub const NETWORK_LIMITED: ServiceFlags = ServiceFlags(1 << 10);
/// P2P_V2 indicates that the node supports the P2P v2 encrypted transport protocol.
- /// See BIP324 for details on how this is implemented.
+ /// See BIP-0324 for details on how this is implemented.
pub const P2P_V2: ServiceFlags = ServiceFlags(1 << 11);
// NOTE: When adding new flags, remember to update the Display impl accordingly.
diff --git a/p2p/src/message.rs b/p2p/src/message.rs
index b28cf903..aab631e7 100644
--- a/p2p/src/message.rs
+++ b/p2p/src/message.rs
@@ -178,7 +178,7 @@ pub struct V1MessageHeader {
impl_consensus_encoding!(V1MessageHeader, magic, command, length, checksum);
-/// A Network message using the v2 p2p protocol defined in BIP324.
+/// A Network message using the v2 p2p protocol defined in BIP-0324.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct V2NetworkMessage {
payload: NetworkMessage,
@@ -238,31 +238,31 @@ pub enum NetworkMessage {
Pong(u64),
/// `merkleblock`
MerkleBlock(MerkleBlock),
- /// BIP 37 `filterload`
+ /// BIP-0037 `filterload`
FilterLoad(message_bloom::FilterLoad),
- /// BIP 37 `filteradd`
+ /// BIP-0037 `filteradd`
FilterAdd(message_bloom::FilterAdd),
- /// BIP 37 `filterclear`
+ /// BIP-0037 `filterclear`
FilterClear,
- /// BIP157 getcfilters
+ /// BIP-0157 getcfilters
GetCFilters(message_filter::GetCFilters),
- /// BIP157 cfilter
+ /// BIP-0157 cfilter
CFilter(message_filter::CFilter),
- /// BIP157 getcfheaders
+ /// BIP-0157 getcfheaders
GetCFHeaders(message_filter::GetCFHeaders),
- /// BIP157 cfheaders
+ /// BIP-0157 cfheaders
CFHeaders(message_filter::CFHeaders),
- /// BIP157 getcfcheckpt
+ /// BIP-0157 getcfcheckpt
GetCFCheckpt(message_filter::GetCFCheckpt),
- /// BIP157 cfcheckpt
+ /// BIP-0157 cfcheckpt
CFCheckpt(message_filter::CFCheckpt),
- /// BIP152 sendcmpct
+ /// BIP-0152 sendcmpct
SendCmpct(message_compact_blocks::SendCmpct),
- /// BIP152 cmpctblock
+ /// BIP-0152 cmpctblock
CmpctBlock(message_compact_blocks::CmpctBlock),
- /// BIP152 getblocktxn
+ /// BIP-0152 getblocktxn
GetBlockTxn(message_compact_blocks::GetBlockTxn),
- /// BIP152 blocktxn
+ /// BIP-0152 blocktxn
BlockTxn(message_compact_blocks::BlockTxn),
/// `alert`
Alert(message_network::Alert),
diff --git a/p2p/src/message_bloom.rs b/p2p/src/message_bloom.rs
index 0b1ed8c8..09051b9a 100644
--- a/p2p/src/message_bloom.rs
+++ b/p2p/src/message_bloom.rs
@@ -2,7 +2,7 @@
//! Bitcoin Connection Bloom filtering network messages.
//!
-//! This module describes BIP37 Connection Bloom filtering network messages.
+//! This module describes BIP-0037 Connection Bloom filtering network messages.
use alloc::vec::Vec;
diff --git a/p2p/src/message_compact_blocks.rs b/p2p/src/message_compact_blocks.rs
index a87bd059..f8a0d0e7 100644
--- a/p2p/src/message_compact_blocks.rs
+++ b/p2p/src/message_compact_blocks.rs
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: CC0-1.0
//!
-//! BIP152 Compact Blocks network messages
+//! BIP-0152 Compact Blocks network messages
use bitcoin::bip152;
diff --git a/p2p/src/message_filter.rs b/p2p/src/message_filter.rs
index 104c8dc6..8b6395dd 100644
--- a/p2p/src/message_filter.rs
+++ b/p2p/src/message_filter.rs
@@ -2,7 +2,7 @@
//! Bitcoin Client Side Block Filtering network messages.
//!
-//! This module describes BIP157 Client Side Block Filtering network messages.
+//! This module describes BIP-0157 Client Side Block Filtering network messages.
use alloc::vec::Vec;
diff --git a/p2p/src/message_network.rs b/p2p/src/message_network.rs
index d895b3fc..a4676ce8 100644
--- a/p2p/src/message_network.rs
+++ b/p2p/src/message_network.rs
@@ -91,7 +91,7 @@ impl_consensus_encoding!(
relay
);
-/// A bitcoin user agent defined by BIP-14. The user agent is sent in the version message when a
+/// A bitcoin user agent defined by BIP-0014. The user agent is sent in the version message when a
/// connection between two peers is established. It is intended to advertise client software in a
/// well-defined format.
///
@@ -131,7 +131,7 @@ impl UserAgent {
Self { user_agent: agent }
}
- /// Build a user agent, ignoring BIP-14 recommendations.
+ /// Build a user agent, ignoring BIP-0014 recommendations.
pub fn from_nonstandard<S: ToString>(agent: S) -> Self {
Self { user_agent: agent.to_string() }
}
@@ -164,7 +164,7 @@ impl From<UserAgent> for String {
fn from(agent: UserAgent) -> Self { agent.user_agent }
}
-/// A software version field for inclusion in a user agent specified by BIP-14.
+/// A software version field for inclusion in a user agent specified by BIP-0014.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct UserAgentVersion {
version: ClientSoftwareVersion,
diff --git a/primitives/src/block.rs b/primitives/src/block.rs
index ded539ae..964201f1 100644
--- a/primitives/src/block.rs
+++ b/primitives/src/block.rs
@@ -268,8 +268,8 @@ impl From<&Header> for BlockHash {
///
/// # Relevant BIPs
///
-/// * [BIP9 - Version bits with timeout and delay](https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki) (current usage)
-/// * [BIP34 - Block v2, Height in Coinbase](https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki)
+/// * [BIP-0009 - Version bits with timeout and delay](https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki) (current usage)
+/// * [BIP-0034 - Block v2, Height in Coinbase](https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki)
#[derive(Copy, PartialEq, Eq, Clone, Debug, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Version(i32);
@@ -278,13 +278,13 @@ impl Version {
/// The original Bitcoin Block v1.
pub const ONE: Self = Self(1);
- /// BIP-34 Block v2.
+ /// BIP-0034 Block v2.
pub const TWO: Self = Self(2);
- /// BIP-9 compatible version number that does not signal for any softforks.
+ /// BIP-0009 compatible version number that does not signal for any softforks.
pub const NO_SOFT_FORK_SIGNALLING: Self = Self(Self::USE_VERSION_BITS as i32);
- /// BIP-9 soft fork signal bits mask.
+ /// BIP-0009 soft fork signal bits mask.
const VERSION_BITS_MASK: u32 = 0x1FFF_FFFF;
/// 32bit value starting with `001` to use version bits.
@@ -306,7 +306,7 @@ impl Version {
/// Checks whether the version number is signalling a soft fork at the given bit.
///
- /// A block is signalling for a soft fork under BIP-9 if the first 3 bits are `001` and
+ /// A block is signalling for a soft fork under BIP-0009 if the first 3 bits are `001` and
/// the version bit for the specific soft fork is toggled on.
pub fn is_signalling_soft_fork(self, bit: u8) -> bool {
// Only bits [0, 28] inclusive are used for signalling.
diff --git a/primitives/src/opcodes.rs b/primitives/src/opcodes.rs
index 376478ff..fea411a0 100644
--- a/primitives/src/opcodes.rs
+++ b/primitives/src/opcodes.rs
@@ -339,7 +339,7 @@ all_opcodes! {
/// Classification context for the opcode.
///
/// Some opcodes like [`OP_RESERVED`] abort the script in `ClassifyContext::Legacy` context,
-/// but will act as `OP_SUCCESSx` in `ClassifyContext::TapScript` (see BIP342 for full list).
+/// but will act as `OP_SUCCESSx` in `ClassifyContext::TapScript` (see BIP-0342 for full list).
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum ClassifyContext {
/// Opcode used in tapscript context.
diff --git a/primitives/src/transaction.rs b/primitives/src/transaction.rs
index 3ca18d15..2f5b06e9 100644
--- a/primitives/src/transaction.rs
+++ b/primitives/src/transaction.rs
@@ -55,14 +55,14 @@ use crate::witness::Witness;
/// # Serialization notes
///
/// If any inputs have nonempty witnesses, the entire transaction is serialized
-/// in the post-BIP141 SegWit format which includes a list of witnesses. If all
-/// inputs have empty witnesses, the transaction is serialized in the pre-BIP141
+/// in the post-BIP-0141 SegWit format which includes a list of witnesses. If all
+/// inputs have empty witnesses, the transaction is serialized in the pre-BIP-0141
/// format.
///
/// There is one major exception to this: to avoid deserialization ambiguity,
-/// if the transaction has no inputs, it is serialized in the BIP141 style. Be
+/// if the transaction has no inputs, it is serialized in the BIP-0141 style. Be
/// aware that this differs from the transaction format in PSBT, which _never_
-/// uses BIP141. (Ordinarily there is no conflict, since in PSBT transactions
+/// uses BIP-0141. (Ordinarily there is no conflict, since in PSBT transactions
/// are always unsigned and therefore their inputs have empty witnesses.)
///
/// The specific ambiguity is that SegWit uses the flag bytes `0001` where an old
@@ -173,7 +173,7 @@ impl Transaction {
if self.inputs.iter().any(|input| !input.witness.is_empty()) {
return true;
}
- // To avoid serialization ambiguity, no inputs means we use BIP141 serialization (see
+ // To avoid serialization ambiguity, no inputs means we use BIP-0141 serialization (see
// `Transaction` docs for full explanation).
self.inputs.is_empty()
}
diff --git a/units/src/locktime/absolute/mod.rs b/units/src/locktime/absolute/mod.rs
index ca24454a..65e10c64 100644
--- a/units/src/locktime/absolute/mod.rs
+++ b/units/src/locktime/absolute/mod.rs
@@ -56,8 +56,8 @@ pub const LOCK_TIME_THRESHOLD: u32 = 500_000_000;
///
/// # Relevant BIPs
///
-/// * [BIP-65 OP_CHECKLOCKTIMEVERIFY](https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki)
-/// * [BIP-113 Median time-past as endpoint for lock-time calculations](https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki)
+/// * [BIP-0065 OP_CHECKLOCKTIMEVERIFY](https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki)
+/// * [BIP-0113 Median time-past as endpoint for lock-time calculations](https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki)
///
/// # Examples
///
@@ -218,9 +218,9 @@ impl LockTime {
/// If the locktime is set to an MTP `T`, the transaction can be included in a block only if
/// the MTP of last recent 11 blocks is greater than `T`.
///
- /// It is possible to broadcast the transaction once the MTP is greater than `T`. See BIP-113.
+ /// It is possible to broadcast the transaction once the MTP is greater than `T`. See BIP-0113.
///
- /// [BIP-113 Median time-past as endpoint for lock-time calculations](https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki)
+ /// [BIP-0113 Median time-past as endpoint for lock-time calculations](https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki)
///
/// See [`LOCK_TIME_THRESHOLD`] for definition of a valid time value.
///
diff --git a/units/src/locktime/relative/mod.rs b/units/src/locktime/relative/mod.rs
index 2c4f6f0b..c5fcecf5 100644
--- a/units/src/locktime/relative/mod.rs
+++ b/units/src/locktime/relative/mod.rs
@@ -38,8 +38,8 @@ pub use self::error::{
///
/// # Relevant BIPs
///
-/// * [BIP 68 Relative lock-time using consensus-enforced sequence numbers](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki)
-/// * [BIP 112 CHECKSEQUENCEVERIFY](https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki)
+/// * [BIP-0068 Relative lock-time using consensus-enforced sequence numbers](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki)
+/// * [BIP-0112 CHECKSEQUENCEVERIFY](https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki)
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum LockTime {
/// A block height lock time value.
@@ -485,7 +485,7 @@ pub type Time = NumberOf512Seconds;
/// A relative lock time lock-by-time value.
///
-/// For BIP 68 relative lock-by-time locks, time is measured in 512 second intervals.
+/// For BIP-0068 relative lock-by-time locks, time is measured in 512 second intervals.
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct NumberOf512Seconds(u16);
diff --git a/units/src/sequence.rs b/units/src/sequence.rs
index d8fa7921..b6fe5709 100644
--- a/units/src/sequence.rs
+++ b/units/src/sequence.rs
@@ -4,15 +4,15 @@
//!
//! The sequence field is used for:
//! - Indicating whether absolute lock-time (specified in `lock_time` field of `Transaction`) is enabled.
-//! - Indicating and encoding [BIP-68] relative lock-times.
-//! - Indicating whether a transaction opts-in to [BIP-125] replace-by-fee.
+//! - Indicating and encoding [BIP-0068] relative lock-times.
+//! - Indicating whether a transaction opts-in to [BIP-0125] replace-by-fee.
//!
//! Note that transactions spending an output with `OP_CHECKLOCKTIMEVERIFY` MUST NOT use
-//! `Sequence::MAX` for the corresponding input. [BIP-65]
+//! `Sequence::MAX` for the corresponding input. [BIP-0065]
//!
-//! [BIP-65]: <https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki>
-//! [BIP-68]: <https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki>
-//! [BIP-125]: <https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki>
+//! [BIP-0065]: <https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki>
+//! [BIP-0068]: <https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki>
+//! [BIP-0125]: <https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki>
use core::fmt;
@@ -61,13 +61,13 @@ impl Sequence {
///
/// A transaction is considered to have opted in to replacement of itself
/// if any of it's inputs have a `Sequence` number less than this value
- /// (Explicit Signalling [BIP-125]).
+ /// (Explicit Signalling [BIP-0125]).
///
- /// [BIP-125]: <https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki>
+ /// [BIP-0125]: <https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki>
const MIN_NO_RBF: Self = Sequence(0xFFFF_FFFE);
- /// BIP-68 relative lock time disable flag mask.
+ /// BIP-0068 relative lock time disable flag mask.
const LOCK_TIME_DISABLE_FLAG_MASK: u32 = 0x8000_0000;
- /// BIP-68 relative lock time type flag mask.
+ /// BIP-0068 relative lock time type flag mask.
pub(super) const LOCK_TYPE_MASK: u32 = 0x0040_0000;
/// Returns `true` if the sequence number enables absolute lock-time (`Transaction::lock_time`).
@@ -89,14 +89,14 @@ impl Sequence {
///
/// Some other references to the term:
/// - `CTxIn::SEQUENCE_FINAL` in the Bitcoin Core code.
- /// - [BIP-112]: "BIP 68 prevents a non-final transaction from being selected for inclusion in a
+ /// - [BIP-0112]: "BIP-0068 prevents a non-final transaction from being selected for inclusion in a
/// block until the corresponding input has reached the specified age"
///
- /// [BIP-112]: <https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki>
+ /// [BIP-0112]: <https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki>
#[inline]
pub fn is_final(self) -> bool { !self.enables_absolute_lock_time() }
- /// Returns true if the transaction opted-in to BIP125 replace-by-fee.
+ /// Returns true if the transaction opted-in to BIP-0125 replace-by-fee.
///
/// Replace by fee is signaled by the sequence being less than 0xfffffffe which is checked by
/// this method. Note, this is the highest "non-final" value (see [`Sequence::is_final`]).
@@ -222,7 +222,7 @@ impl Sequence {
/// Returns the low 16 bits from sequence number.
///
- /// BIP-68 only uses the low 16 bits for relative lock value.
+ /// BIP-0068 only uses the low 16 bits for relative lock value.
#[inline]
fn low_u16(self) -> u16 { self.0 as u16 }
}
diff --git a/units/src/weight.rs b/units/src/weight.rs
index e450978b..1a15de7b 100644
--- a/units/src/weight.rs
+++ b/units/src/weight.rs
@@ -53,7 +53,7 @@ impl Weight {
/// The factor that non-witness serialization data is multiplied by during weight calculation.
pub const WITNESS_SCALE_FACTOR: u64 = WITNESS_SCALE_FACTOR as u64; // this value is 4
- /// The maximum allowed weight for a block, see BIP 141 (network rule).
+ /// The maximum allowed weight for a block, see BIP-0141 (network rule).
pub const MAX_BLOCK: Weight = Weight::from_wu(4_000_000);
/// The minimum transaction weight for a valid serialized transaction.
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.