Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions src/descriptor/bare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::expression::{self, FromTree};
use crate::miniscript::context::{ScriptContext, ScriptContextError};
use crate::miniscript::satisfy::{Placeholder, Satisfaction, Witness};
use crate::plan::AssetProvider;
use crate::policy::{semantic, Liftable};
use crate::policy::{Liftable, Semantic};
use crate::prelude::*;
use crate::util::{varint_len, witness_to_scriptsig};
use crate::{
Expand Down Expand Up @@ -165,14 +165,14 @@ impl<Pk: MiniscriptKey> fmt::Display for Bare<Pk> {
}

impl<Pk: MiniscriptKey> Liftable<Pk> for Bare<Pk> {
fn lift(&self) -> Result<semantic::Policy<Pk>, Error> { self.ms.lift() }
fn lift(&self) -> Result<Semantic<Pk>, Error> { self.ms.lift() }
}

impl<Pk: FromStrKey> FromTree for Bare<Pk> {
fn from_tree(root: expression::TreeIterItem) -> Result<Self, Error> {
let sub = Miniscript::<Pk, BareCtx>::from_tree(root)?;
BareCtx::top_level_checks(&sub)?;
Bare::new(sub)
Self::new(sub)
}
}

Expand Down Expand Up @@ -202,7 +202,7 @@ impl<Pk: MiniscriptKey> Pkh<Pk> {
pub fn new(pk: Pk) -> Result<Self, ScriptContextError> {
// do the top-level checks
match BareCtx::check_pk(&pk) {
Ok(()) => Ok(Pkh { pk }),
Ok(()) => Ok(Self { pk }),
Err(e) => Err(e),
}
}
Expand Down Expand Up @@ -349,17 +349,15 @@ impl<Pk: MiniscriptKey> fmt::Display for Pkh<Pk> {
}

impl<Pk: MiniscriptKey> Liftable<Pk> for Pkh<Pk> {
fn lift(&self) -> Result<semantic::Policy<Pk>, Error> {
Ok(semantic::Policy::Key(self.pk.clone()))
}
fn lift(&self) -> Result<Semantic<Pk>, Error> { Ok(Semantic::Key(self.pk.clone())) }
}

impl<Pk: FromStrKey> FromTree for Pkh<Pk> {
fn from_tree(root: expression::TreeIterItem) -> Result<Self, Error> {
let pk = root
.verify_terminal_parent("pkh", "public key")
.map_err(Error::Parse)?;
Pkh::new(pk).map_err(Error::ContextError)
Self::new(pk).map_err(Error::ContextError)
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/descriptor/checksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ pub enum Error {
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
Error::InvalidCharacter { ch, pos } => {
Self::InvalidCharacter { ch, pos } => {
write!(f, "invalid character '{}' (position {})", ch, pos)
}
Error::InvalidChecksumLength { actual, expected } => {
Self::InvalidChecksumLength { actual, expected } => {
write!(f, "invalid checksum (length {}, expected {})", actual, expected)
}
Error::InvalidChecksum { actual, expected } => {
Self::InvalidChecksum { actual, expected } => {
f.write_str("invalid checksum ")?;
for ch in actual {
ch.fmt(f)?;
Expand Down Expand Up @@ -135,13 +135,13 @@ pub struct Engine {
}

impl Default for Engine {
fn default() -> Engine { Engine::new() }
fn default() -> Self { Self::new() }
}

impl Engine {
/// Constructs an engine with no input.
pub fn new() -> Self {
Engine { inner: bech32::primitives::checksum::Engine::new(), cls: 0, clscount: 0 }
Self { inner: bech32::primitives::checksum::Engine::new(), cls: 0, clscount: 0 }
}

/// Inputs some data into the checksum engine.
Expand Down
Loading
Loading