| 399 | namespace |
| 400 | { |
| 401 | class CScriptVisitor : public boost::static_visitor<bool> |
| 402 | { |
| 403 | private: |
| 404 | CScript *script; |
| 405 | public: |
| 406 | explicit CScriptVisitor(CScript *scriptin) { script = scriptin; } |
| 407 | |
| 408 | bool operator()(const CNoDestination &dest) const { |
| 409 | script->clear(); |
| 410 | return false; |
| 411 | } |
| 412 | |
| 413 | bool operator()(const CKeyID &keyID) const { |
| 414 | script->clear(); |
| 415 | *script << OP_DUP << OP_HASH160 << ToByteVector(keyID) << OP_EQUALVERIFY << OP_CHECKSIG; |
| 416 | return true; |
| 417 | } |
| 418 | |
| 419 | bool operator()(const CScriptID &scriptID) const { |
| 420 | script->clear(); |
| 421 | *script << OP_HASH160 << ToByteVector(scriptID) << OP_EQUAL; |
| 422 | return true; |
| 423 | } |
| 424 | |
| 425 | bool operator()(const WitnessV0KeyHash& id) const |
| 426 | { |
| 427 | script->clear(); |
| 428 | *script << OP_0 << ToByteVector(id); |
| 429 | return true; |
| 430 | } |
| 431 | |
| 432 | bool operator()(const WitnessV0ScriptHash& id) const |
| 433 | { |
| 434 | script->clear(); |
| 435 | *script << OP_0 << ToByteVector(id); |
| 436 | return true; |
| 437 | } |
| 438 | |
| 439 | bool operator()(const WitnessUnknown& id) const |
| 440 | { |
| 441 | script->clear(); |
| 442 | *script << CScript::EncodeOP_N(id.version) << std::vector<unsigned char>(id.program, id.program + id.length); |
| 443 | return true; |
| 444 | } |
| 445 | }; |
| 446 | } |
| 447 | |
| 448 | uint160 GetHashForDestination(const CTxDestination& dest) |
no outgoing calls
no test coverage detected