Fix rustdocs in `blockdata`

Following up on the comment in #2646 the rustdocs formatting was fixed.
This commit is contained in:
Jamil Lambert, PhD 2024-07-18 11:04:35 +01:00
parent 59c806996c
commit 3b15ef6d27
4 changed files with 19 additions and 16 deletions

View File

@ -341,9 +341,9 @@ impl Script {
/// Get redeemScript following BIP16 rules regarding P2SH spending. /// Get redeemScript following BIP16 rules regarding P2SH spending.
/// ///
/// This does not guarantee that this represents a P2SH input [`Script`]. /// This does not guarantee that this represents a P2SH input [`Script`].
/// It merely gets the last push of the script. Use /// It merely gets the last push of the script.
/// [`Script::is_p2sh`](crate::blockdata::script::Script::is_p2sh) on the ///
/// scriptPubKey to check whether it is actually a P2SH script. /// Use [`Script::is_p2sh`] on the scriptPubKey to check whether it is actually a P2SH script.
pub fn redeem_script(&self) -> Option<&Script> { pub fn redeem_script(&self) -> Option<&Script> {
// Script must consist entirely of pushes. // Script must consist entirely of pushes.
if self.instructions().any(|i| i.is_err() || i.unwrap().push_bytes().is_none()) { if self.instructions().any(|i| i.is_err() || i.unwrap().push_bytes().is_none()) {

View File

@ -241,6 +241,7 @@ pub fn write_scriptint(out: &mut [u8; 8], n: i64) -> usize {
/// Decodes an integer in script format without non-minimal error. /// Decodes an integer in script format without non-minimal error.
/// ///
/// The overflow error for slices over 4 bytes long is still there. /// The overflow error for slices over 4 bytes long is still there.
///
/// See [`push_bytes::PushBytes::read_scriptint`] for a description of some subtleties of /// See [`push_bytes::PushBytes::read_scriptint`] for a description of some subtleties of
/// this function. /// this function.
pub fn read_scriptint_non_minimal(v: &[u8]) -> Result<i64, Error> { pub fn read_scriptint_non_minimal(v: &[u8]) -> Result<i64, Error> {

View File

@ -40,7 +40,9 @@ hashes::hash_newtype! {
/// For compatibility with the existing Bitcoin infrastructure and historical and current /// For compatibility with the existing Bitcoin infrastructure and historical and current
/// versions of the Bitcoin Core software itself, this and other [`sha256d::Hash`] types, are /// versions of the Bitcoin Core software itself, this and other [`sha256d::Hash`] types, are
/// serialized in reverse byte order when converted to a hex string via [`std::fmt::Display`] /// serialized in reverse byte order when converted to a hex string via [`std::fmt::Display`]
/// trait operations. See [`hashes::Hash::DISPLAY_BACKWARD`] for more details. /// trait operations.
///
/// See [`hashes::Hash::DISPLAY_BACKWARD`] for more details.
pub struct Txid(sha256d::Hash); pub struct Txid(sha256d::Hash);
/// A bitcoin witness transaction ID. /// A bitcoin witness transaction ID.

View File

@ -399,9 +399,9 @@ impl Witness {
/// ///
/// This does not guarantee that this represents a P2TR [`Witness`]. It /// This does not guarantee that this represents a P2TR [`Witness`]. It
/// merely gets the second to last or third to last element depending on /// merely gets the second to last or third to last element depending on
/// the first byte of the last element being equal to 0x50. See /// the first byte of the last element being equal to 0x50.
/// [Script::is_p2tr](crate::script::Script::is_p2tr) to ///
/// check whether this is actually a Taproot witness. /// See [`Script::is_p2tr`] to check whether this is actually a Taproot witness.
pub fn tapscript(&self) -> Option<&Script> { pub fn tapscript(&self) -> Option<&Script> {
self.last().and_then(|last| { self.last().and_then(|last| {
// From BIP341: // From BIP341:
@ -422,9 +422,9 @@ impl Witness {
/// ///
/// This does not guarantee that this represents a P2TR [`Witness`]. It /// This does not guarantee that this represents a P2TR [`Witness`]. It
/// merely gets the last or second to last element depending on the first /// merely gets the last or second to last element depending on the first
/// byte of the last element being equal to 0x50. See /// byte of the last element being equal to 0x50.
/// [Script::is_p2tr](crate::blockdata::script::Script::is_p2tr) to ///
/// check whether this is actually a Taproot witness. /// See [`Script::is_p2tr`] to check whether this is actually a Taproot witness.
pub fn taproot_control_block(&self) -> Option<&[u8]> { pub fn taproot_control_block(&self) -> Option<&[u8]> {
self.last().and_then(|last| { self.last().and_then(|last| {
// From BIP341: // From BIP341:
@ -443,9 +443,9 @@ impl Witness {
/// Get the taproot annex following BIP341 rules. /// Get the taproot annex following BIP341 rules.
/// ///
/// This does not guarantee that this represents a P2TR [`Witness`]. See /// This does not guarantee that this represents a P2TR [`Witness`].
/// [Script::is_p2tr](crate::blockdata::script::Script::is_p2tr) to ///
/// check whether this is actually a Taproot witness. /// See [`Script::is_p2tr`] to check whether this is actually a Taproot witness.
pub fn taproot_annex(&self) -> Option<&[u8]> { pub fn taproot_annex(&self) -> Option<&[u8]> {
self.last().and_then(|last| { self.last().and_then(|last| {
// From BIP341: // From BIP341:
@ -462,9 +462,9 @@ impl Witness {
/// Get the p2wsh witness script following BIP141 rules. /// Get the p2wsh witness script following BIP141 rules.
/// ///
/// This does not guarantee that this represents a P2WS [`Witness`]. See /// This does not guarantee that this represents a P2WS [`Witness`].
/// [Script::is_p2wsh](crate::blockdata::script::Script::is_p2wsh) to ///
/// check whether this is actually a P2WSH witness. /// See [`Script::is_p2wsh`] to check whether this is actually a P2WSH witness.
pub fn witness_script(&self) -> Option<&Script> { self.last().map(Script::from_bytes) } pub fn witness_script(&self) -> Option<&Script> { self.last().map(Script::from_bytes) }
} }