Wrap `Script` impl blocks in temporary modules

`rustfmt` is unable to format macro calls so instead we wrap the impl
blocks in modules to enable formatting in the next commit. We need to
change the visibility of the methods but that's OK since they're
internal.
This commit is contained in:
Martin Habovstiak 2024-08-11 15:31:10 +02:00
parent 5a461545c7
commit b027edffe7
1 changed files with 8 additions and 2 deletions

View File

@ -135,6 +135,8 @@ impl Script {
}
}
mod tmp_pub {
use super::*;
impl Script {
/// Returns an iterator over script bytes.
#[inline]
@ -502,9 +504,12 @@ impl Script {
self.as_bytes().first().copied().map(From::from)
}
}
}
mod tmp_priv {
use super::*;
impl Script {
fn minimal_non_dust_internal(&self, dust_relay_fee: u64) -> crate::Amount {
pub(crate) fn minimal_non_dust_internal(&self, dust_relay_fee: u64) -> crate::Amount {
// This must never be lower than Bitcoin Core's GetDustThreshold() (as of v0.21) as it may
// otherwise allow users to create transactions which likely can never be broadcast/confirmed.
let sats = dust_relay_fee
@ -527,7 +532,7 @@ impl Script {
crate::Amount::from_sat(sats)
}
fn count_sigops_internal(&self, accurate: bool) -> usize {
pub(crate) fn count_sigops_internal(&self, accurate: bool) -> usize {
let mut n = 0;
let mut pushnum_cache = None;
for inst in self.instructions() {
@ -590,6 +595,7 @@ impl Script {
}
}
}
}
/// Iterator over bytes of a script
pub struct Bytes<'a>(core::iter::Copied<core::slice::Iter<'a, u8>>);