miniscript: introduce a MsContext() helper to contexts

We are going to introduce Tapscript support in Miniscript, for which
some of Miniscript rules and properties change (new or modified
fragments, different typing rules, different resources consumption, ..).
This commit is contained in:
Antoine Poinsot
2023-01-21 13:43:15 +01:00
parent bba9340a94
commit c3738d0344
5 changed files with 35 additions and 3 deletions

View File

@@ -114,6 +114,8 @@ typedef std::pair<ChallengeType, uint32_t> Challenge;
struct KeyConverter {
typedef CPubKey Key;
const miniscript::MiniscriptContext m_script_ctx{miniscript::MiniscriptContext::P2WSH};
bool KeyCompare(const Key& a, const Key& b) const {
return a < b;
}
@@ -158,6 +160,10 @@ struct KeyConverter {
std::optional<std::string> ToString(const Key& key) const {
return HexStr(ToPKBytes(key));
}
miniscript::MiniscriptContext MsContext() const {
return m_script_ctx;
}
};
/** A class that encapsulates all signing/hash revealing operations. */