Bitcoin Core  24.99.0
P2P Digital Currency
Classes | Namespaces | Typedefs | Enumerations | Functions
miniscript.h File Reference
#include <algorithm>
#include <functional>
#include <numeric>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include <assert.h>
#include <cstdlib>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <script/script.h>
#include <span.h>
#include <util/spanparsing.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/vector.h>
Include dependency graph for miniscript.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  miniscript::Type
 This type encapsulates the miniscript type system properties. More...
 
struct  miniscript::internal::MaxInt< I >
 Class whose objects represent the maximum of a list of integers. More...
 
struct  miniscript::internal::Ops
 
struct  miniscript::internal::StackSize
 
struct  miniscript::internal::NoDupCheck
 
struct  miniscript::Node< Key >
 A node in a miniscript expression. More...
 

Namespaces

 miniscript
 
 miniscript::internal
 

Typedefs

using miniscript::Opcode = std::pair< opcodetype, std::vector< unsigned char > >
 
template<typename Key >
using miniscript::NodeRef = std::shared_ptr< const Node< Key > >
 

Enumerations

enum class  miniscript::Fragment {
  miniscript::JUST_0 , miniscript::JUST_1 , miniscript::PK_K , miniscript::PK_H ,
  miniscript::OLDER , miniscript::AFTER , miniscript::SHA256 , miniscript::HASH256 ,
  miniscript::RIPEMD160 , miniscript::HASH160 , miniscript::WRAP_A , miniscript::WRAP_S ,
  miniscript::WRAP_C , miniscript::WRAP_D , miniscript::WRAP_V , miniscript::WRAP_J ,
  miniscript::WRAP_N , miniscript::AND_V , miniscript::AND_B , miniscript::OR_B ,
  miniscript::OR_C , miniscript::OR_D , miniscript::OR_I , miniscript::ANDOR ,
  miniscript::THRESH , miniscript::MULTI
}
 The different node types in miniscript. More...
 
enum class  miniscript::internal::ParseContext {
  miniscript::internal::WRAPPED_EXPR , miniscript::internal::EXPR , miniscript::internal::SWAP , miniscript::internal::ALT ,
  miniscript::internal::CHECK , miniscript::internal::DUP_IF , miniscript::internal::VERIFY , miniscript::internal::NON_ZERO ,
  miniscript::internal::ZERO_NOTEQUAL , miniscript::internal::WRAP_U , miniscript::internal::WRAP_T , miniscript::internal::AND_N ,
  miniscript::internal::AND_V , miniscript::internal::AND_B , miniscript::internal::ANDOR , miniscript::internal::OR_B ,
  miniscript::internal::OR_C , miniscript::internal::OR_D , miniscript::internal::OR_I , miniscript::internal::THRESH ,
  miniscript::internal::COMMA , miniscript::internal::CLOSE_BRACKET
}
 
enum class  miniscript::internal::DecodeContext {
  miniscript::internal::SINGLE_BKV_EXPR , miniscript::internal::BKV_EXPR , miniscript::internal::W_EXPR , miniscript::internal::SWAP ,
  miniscript::internal::ALT , miniscript::internal::CHECK , miniscript::internal::DUP_IF , miniscript::internal::VERIFY ,
  miniscript::internal::NON_ZERO , miniscript::internal::ZERO_NOTEQUAL , miniscript::internal::MAYBE_AND_V , miniscript::internal::AND_V ,
  miniscript::internal::AND_B , miniscript::internal::ANDOR , miniscript::internal::OR_B , miniscript::internal::OR_C ,
  miniscript::internal::OR_D , miniscript::internal::THRESH_W , miniscript::internal::THRESH_E , miniscript::internal::ENDIF ,
  miniscript::internal::ENDIF_NOTIF , miniscript::internal::ENDIF_ELSE
}
 

Functions

constexpr Type miniscript::operator""_mst (const char *c, size_t l)
 Literal operator to construct Type objects. More...
 
template<typename Key , typename... Args>
NodeRef< Key > miniscript::MakeNodeRef (Args &&... args)
 Construct a miniscript node as a shared_ptr. More...
 
Type miniscript::internal::ComputeType (Fragment fragment, Type x, Type y, Type z, const std::vector< Type > &sub_types, uint32_t k, size_t data_size, size_t n_subs, size_t n_keys)
 Helper function for Node::CalcType. More...
 
size_t miniscript::internal::ComputeScriptLen (Fragment fragment, Type sub0typ, size_t subsize, uint32_t k, size_t n_subs, size_t n_keys)
 Helper function for Node::CalcScriptLen. More...
 
Type miniscript::internal::SanitizeType (Type x)
 A helper sanitizer/checker for the output of CalcType. More...
 
int miniscript::internal::FindNextChar (Span< const char > sp, const char m)
 
template<typename Key , typename Ctx >
std::optional< std::pair< Key, int > > miniscript::internal::ParseKeyEnd (Span< const char > in, const Ctx &ctx)
 Parse a key string ending at the end of the fragment's text representation. More...
 
template<typename Ctx >
std::optional< std::pair< std::vector< unsigned char >, int > > miniscript::internal::ParseHexStrEnd (Span< const char > in, const size_t expected_size, const Ctx &ctx)
 Parse a hex string ending at the end of the fragment's text representation. More...
 
template<typename Key >
void miniscript::internal::BuildBack (Fragment nt, std::vector< NodeRef< Key >> &constructed, const bool reverse=false)
 BuildBack pops the last two elements off constructed and wraps them in the specified Fragment. More...
 
template<typename Key , typename Ctx >
NodeRef< Key > miniscript::internal::Parse (Span< const char > in, const Ctx &ctx)
 Parse a miniscript from its textual descriptor form. More...
 
std::optional< std::vector< Opcode > > miniscript::internal::DecomposeScript (const CScript &script)
 Decode a script into opcode/push pairs. More...
 
std::optional< int64_t > miniscript::internal::ParseScriptNumber (const Opcode &in)
 Determine whether the passed pair (created by DecomposeScript) is pushing a number. More...
 
template<typename Key , typename Ctx , typename I >
NodeRef< Key > miniscript::internal::DecodeScript (I &in, I last, const Ctx &ctx)
 Parse a miniscript from a bitcoin script. More...
 
template<typename Ctx >
NodeRef< typename Ctx::Key > miniscript::FromString (const std::string &str, const Ctx &ctx)
 
template<typename Ctx >
NodeRef< typename Ctx::Key > miniscript::FromScript (const CScript &script, const Ctx &ctx)