MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / FromScript

Function FromScript

src/script/miniscript.h:2693–2705  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2691
2692template <typename Ctx>
2693inline std::optional<Node<typename Ctx::Key>> FromScript(const CScript& script, const Ctx& ctx)
2694{
2695 using namespace internal;
2696 // A too large Script is necessarily invalid, don't bother parsing it.
2697 if (script.size() > MaxScriptSize(ctx.MsContext())) return {};
2698 auto decomposed = DecomposeScript(script);
2699 if (!decomposed) return {};
2700 auto it = decomposed->begin();
2701 auto ret = DecodeScript<typename Ctx::Key>(it, decomposed->end(), ctx);
2702 if (!ret) return {};
2703 if (it != decomposed->end()) return {};
2704 return ret;
2705}
2706
2707} // namespace miniscript
2708

Callers 7

InferScriptFunction · 0.85
SignTaprootScriptFunction · 0.85
ProduceSignatureFunction · 0.85
TestMethod · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
TestNodeFunction · 0.85
FUZZ_TARGETFunction · 0.85

Calls 6

MaxScriptSizeFunction · 0.85
DecomposeScriptFunction · 0.85
sizeMethod · 0.45
MsContextMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 4

TestMethod · 0.68
BOOST_AUTO_TEST_CASEFunction · 0.68
TestNodeFunction · 0.68
FUZZ_TARGETFunction · 0.68