| 252 | namespace |
| 253 | { |
| 254 | class CScriptVisitor : public boost::static_visitor<bool> |
| 255 | { |
| 256 | private: |
| 257 | CScript *script; |
| 258 | public: |
| 259 | explicit CScriptVisitor(CScript *scriptin) { script = scriptin; } |
| 260 | |
| 261 | bool operator()(const CNoDestination &dest) const { |
| 262 | script->clear(); |
| 263 | return false; |
| 264 | } |
| 265 | |
| 266 | bool operator()(const CKeyID &keyID) const { |
| 267 | script->clear(); |
| 268 | *script << OP_DUP << OP_HASH160 << ToByteVector(keyID) << OP_EQUALVERIFY << OP_CHECKSIG; |
| 269 | return true; |
| 270 | } |
| 271 | |
| 272 | bool operator()(const CScriptID &scriptID) const { |
| 273 | script->clear(); |
| 274 | *script << OP_HASH160 << ToByteVector(scriptID) << OP_EQUAL; |
| 275 | return true; |
| 276 | } |
| 277 | |
| 278 | bool operator()(const WitnessV0KeyHash& id) const |
| 279 | { |
| 280 | script->clear(); |
| 281 | *script << OP_0 << ToByteVector(id); |
| 282 | return true; |
| 283 | } |
| 284 | |
| 285 | bool operator()(const WitnessV0ScriptHash& id) const |
| 286 | { |
| 287 | script->clear(); |
| 288 | *script << OP_0 << ToByteVector(id); |
| 289 | return true; |
| 290 | } |
| 291 | |
| 292 | bool operator()(const WitnessUnknown& id) const |
| 293 | { |
| 294 | script->clear(); |
| 295 | *script << CScript::EncodeOP_N(id.version) << std::vector<unsigned char>(id.program, id.program + id.length); |
| 296 | return true; |
| 297 | } |
| 298 | }; |
| 299 | } // namespace |
| 300 | |
| 301 | CScript GetScriptForDestination(const CTxDestination& dest) |
no outgoing calls
no test coverage detected