| 106 | |
| 107 | namespace { |
| 108 | class CScriptVisitor |
| 109 | { |
| 110 | public: |
| 111 | CScript operator()(const CNoDestination& dest) const |
| 112 | { |
| 113 | return dest.GetScript(); |
| 114 | } |
| 115 | |
| 116 | CScript operator()(const PubKeyDestination& dest) const |
| 117 | { |
| 118 | return CScript() << ToByteVector(dest.GetPubKey()) << OP_CHECKSIG; |
| 119 | } |
| 120 | |
| 121 | CScript operator()(const PKHash& keyID) const |
| 122 | { |
| 123 | return CScript() << OP_DUP << OP_HASH160 << ToByteVector(keyID) << OP_EQUALVERIFY << OP_CHECKSIG; |
| 124 | } |
| 125 | |
| 126 | CScript operator()(const ScriptHash& scriptID) const |
| 127 | { |
| 128 | return CScript() << OP_HASH160 << ToByteVector(scriptID) << OP_EQUAL; |
| 129 | } |
| 130 | |
| 131 | CScript operator()(const WitnessV0KeyHash& id) const |
| 132 | { |
| 133 | return CScript() << OP_0 << ToByteVector(id); |
| 134 | } |
| 135 | |
| 136 | CScript operator()(const WitnessV0ScriptHash& id) const |
| 137 | { |
| 138 | return CScript() << OP_0 << ToByteVector(id); |
| 139 | } |
| 140 | |
| 141 | CScript operator()(const WitnessV1Taproot& tap) const |
| 142 | { |
| 143 | return CScript() << OP_1 << ToByteVector(tap); |
| 144 | } |
| 145 | |
| 146 | CScript operator()(const WitnessUnknown& id) const |
| 147 | { |
| 148 | return CScript() << CScript::EncodeOP_N(id.GetWitnessVersion()) << id.GetWitnessProgram(); |
| 149 | } |
| 150 | }; |
| 151 | |
| 152 | class ValidDestinationVisitor |
| 153 | { |
no outgoing calls
no test coverage detected