Skip to content

Instantly share code, notes, and snippets.

@sanket1729
Created June 8, 2020 17:04
Show Gist options
  • Select an option

  • Save sanket1729/a53fcdc6bbcc4bf71c257b69c5931d87 to your computer and use it in GitHub Desktop.

Select an option

Save sanket1729/a53fcdc6bbcc4bf71c257b69c5931d87 to your computer and use it in GitHub Desktop.
trait ScriptContext<Pk: MiniscriptKey>{
fn is_valid(&self, node: decode::Terminal<Pk>) -> Result<(), Error>{
}
}
struct Legacy{
}
impl<Pk: MiniscriptKey> ScriptContext<Pk> for Legacy{
}
struct Segwitv0{
}
impl<Pk: MiniscriptKey> ScriptContext<Pk> for Segwitv0{
}
/// Top-level script AST type
#[derive(Clone, Hash)]
pub struct Miniscript<Pk: MiniscriptKey, Ctx: ScriptContext<Pk>> {
///A node in the Abstract Syntax Tree(
pub node: decode::Terminal<Pk>,
///The correctness and malleability type information for the AST node
pub ty: types::Type,
///Additional information helpful for extra analysis.
pub ext: types::extra_props::ExtData,
/// Script Context(Legacy, Segwit ..) under which the miniscript is bieng used
pub ctx: ScriptContext<Pk>,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment