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

Function ScriptPubKey

src/test/miniscript_tests.cpp:326–334  ·  view source on GitHub ↗

The spk for this script under the given context. If it's a Taproot output also record the spend data.

Source from the content-addressed store, hash-verified

324
325//! The spk for this script under the given context. If it's a Taproot output also record the spend data.
326CScript ScriptPubKey(miniscript::MiniscriptContext ctx, const CScript& script, TaprootBuilder& builder)
327{
328 if (!miniscript::IsTapscript(ctx)) return CScript() << OP_0 << WitnessV0ScriptHash(script);
329
330 // For Taproot outputs we always use a tree with a single script and a dummy internal key.
331 builder.Add(0, script, TAPROOT_LEAF_TAPSCRIPT);
332 builder.Finalize(XOnlyPubKey::NUMS_H);
333 return GetScriptForDestination(builder.GetOutput());
334}
335
336//! Fill the witness with the data additional to the script satisfaction.
337void SatisfactionToWitness(miniscript::MiniscriptContext ctx, CScriptWitness& witness, const CScript& script, TaprootBuilder& builder) {

Callers 1

TestSatisfyMethod · 0.70

Calls 7

IsTapscriptFunction · 0.85
WitnessV0ScriptHashClass · 0.85
GetScriptForDestinationFunction · 0.85
CScriptClass · 0.50
AddMethod · 0.45
FinalizeMethod · 0.45
GetOutputMethod · 0.45

Tested by

no test coverage detected