MCPcopy Create free account
hub / github.com/ElementsProject/elements / CScriptVisitor

Class CScriptVisitor

src/script/standard.cpp:295–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293
294namespace {
295class CScriptVisitor
296{
297public:
298 CScript operator()(const CNoDestination& dest) const
299 {
300 return CScript();
301 }
302
303 CScript operator()(const PKHash& keyID) const
304 {
305 return CScript() << OP_DUP << OP_HASH160 << ToByteVector(keyID) << OP_EQUALVERIFY << OP_CHECKSIG;
306 }
307
308 CScript operator()(const ScriptHash& scriptID) const
309 {
310 return CScript() << OP_HASH160 << ToByteVector(scriptID) << OP_EQUAL;
311 }
312
313 CScript operator()(const WitnessV0KeyHash& id) const
314 {
315 return CScript() << OP_0 << ToByteVector(id);
316 }
317
318 CScript operator()(const WitnessV0ScriptHash& id) const
319 {
320 return CScript() << OP_0 << ToByteVector(id);
321 }
322
323 CScript operator()(const WitnessV1Taproot& tap) const
324 {
325 return CScript() << OP_1 << ToByteVector(tap);
326 }
327
328 CScript operator()(const WitnessUnknown& id) const
329 {
330 return CScript() << CScript::EncodeOP_N(id.version) << std::vector<unsigned char>(id.program, id.program + id.length);
331 }
332
333 CScript operator()(const NullData& id) const
334 {
335 CScript script = CScript() << OP_RETURN;
336 for (const auto& push : id.null_data) {
337 script << push;
338 }
339 return script;
340 }
341};
342} // namespace
343
344CScript GetScriptForDestination(const CTxDestination& dest)

Callers 1

GetScriptForDestinationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected