SHARE
TWEET

Untitled

a guest Jul 23rd, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
  2. pub struct Miniscript<Pk, Pkh=hash160::Hash>{
  3.     ///A node in the Abstract Syntax Tree(
  4.     node: astelem::AstElem<Pk, Pkh>,
  5.     ///The correctness and malleability type information for the AST node
  6.     ty: Option<types::Type>,
  7.     ///Additional information helpful for extra analysis.
  8.     ext: Option<types::extra_props::ExtData>
  9. }
  10.  
  11.  
  12. #[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
  13. pub enum AstElem<Pk, Pkh=hash160::Hash> {
  14.     /// `1`
  15.     True,
  16.     /// `0`
  17.     False,
  18.     // pubkey checks
  19.     /// `<key>`
  20.     Pk(Pk),
  21.     /// `DUP HASH160 <keyhash> EQUALVERIFY`
  22.     PkH(Pkh),
  23.     // timelocks
  24.     /// `n CHECKSEQUENCEVERIFY`
  25.     After(u32),
  26.     /// `n CHECKLOCKTIMEVERIFY`
  27.     Older(u32),
  28.     // hashlocks
  29.     /// `SIZE 32 EQUALVERIFY SHA256 <hash> EQUAL`
  30.     Sha256(sha256::Hash),
  31.     /// `SIZE 32 EQUALVERIFY HASH256 <hash> EQUAL`
  32.     Hash256(sha256d::Hash),
  33.     /// `SIZE 32 EQUALVERIFY RIPEMD160 <hash> EQUAL`
  34.     Ripemd160(ripemd160::Hash),
  35.     /// `SIZE 32 EQUALVERIFY HASH160 <hash> EQUAL`
  36.     Hash160(hash160::Hash),
  37.     // Wrappers
  38.     /// `TOALTSTACK [E] FROMALTSTACK`
  39.     Alt(Box<Miniscript<Pk, Pkh>>),
  40.     /// `SWAP [E1]`
  41.     Swap(Box<Miniscript<Pk, Pkh>>),
  42.     /// `[Kt]/[Ke] CHECKSIG`
  43.     Check(Box<Miniscript<Pk, Pkh>>),
  44.     /// `DUP IF [V] ENDIF`
  45.     DupIf(Box<Miniscript<Pk, Pkh>>),
  46.     /// [T] VERIFY
  47.     Verify(Box<Miniscript<Pk, Pkh>>),
  48.     /// SIZE 0NOTEQUAL IF [Fn] ENDIF
  49.     NonZero(Box<Miniscript<Pk, Pkh>>),
  50.     /// [X] 0NOTEQUAL
  51.     ZeroNotEqual(Box<Miniscript<Pk, Pkh>>),
  52.     // Conjunctions
  53.     /// [V] [T]/[V]/[F]/[Kt]
  54.     AndV(Box<Miniscript<Pk, Pkh>>, Box<Miniscript<Pk, Pkh>>),
  55.     /// [E] [W] BOOLAND
  56.     AndB(Box<Miniscript<Pk, Pkh>>, Box<Miniscript<Pk, Pkh>>),
  57.     /// [various] NOTIF [various] ELSE [various] ENDIF
  58.     AndOr(Box<Miniscript<Pk, Pkh>>, Box<Miniscript<Pk, Pkh>>, Box<Miniscript<Pk, Pkh>>),
  59.     // Disjunctions
  60.     /// [E] [W] BOOLOR
  61.     OrB(Box<Miniscript<Pk, Pkh>>, Box<Miniscript<Pk, Pkh>>),
  62.     /// [E] IFDUP NOTIF [T]/[E] ENDIF
  63.     OrD(Box<Miniscript<Pk, Pkh>>, Box<Miniscript<Pk, Pkh>>),
  64.     /// [E] NOTIF [V] ENDIF
  65.     OrC(Box<Miniscript<Pk, Pkh>>, Box<Miniscript<Pk, Pkh>>),
  66.     /// IF [various] ELSE [various] ENDIF
  67.     OrI(Box<Miniscript<Pk, Pkh>>, Box<Miniscript<Pk, Pkh>>),
  68.     // Thresholds
  69.     /// [E] ([W] ADD)* k EQUAL
  70.     Thresh(usize, Vec<Miniscript<Pk, Pkh>>),
  71.     /// k (<key>)* n CHECKMULTISIG
  72.     ThreshM(usize, Vec<Pk>),
  73. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top