Skip to content

Commit bdd6855

Browse files
committed
Make validate_padding public
The `validate_padding` function is useful to users of the library, lets make it public. Rename to `validate_segwit_padding` and make the function public.
1 parent d9b727b commit bdd6855

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/primitives/decode.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ impl<'s> CheckedHrpstring<'s> {
397397
let witness_version = Fe32::from_char(self.ascii[0].into()).unwrap();
398398
self.ascii = &self.ascii[1..]; // Remove the witness version byte.
399399

400-
self.validate_padding()?;
400+
self.validate_segwit_padding()?;
401401
self.validate_witness_program_length(witness_version)?;
402402

403403
Ok(SegwitHrpstring { hrp: self.hrp(), witness_version, ascii: self.ascii })
@@ -410,7 +410,8 @@ impl<'s> CheckedHrpstring<'s> {
410410
/// From BIP-173:
411411
/// > Re-arrange those bits into groups of 8 bits. Any incomplete group at the
412412
/// > end MUST be 4 bits or less, MUST be all zeroes, and is discarded.
413-
fn validate_padding(&self) -> Result<(), PaddingError> {
413+
#[inline]
414+
pub fn validate_segwit_padding(&self) -> Result<(), PaddingError> {
414415
if self.ascii.is_empty() {
415416
return Ok(()); // Empty data implies correct padding.
416417
}

0 commit comments

Comments
 (0)