| 513 | } |
| 514 | |
| 515 | class DescribeWalletBlindAddressVisitor |
| 516 | { |
| 517 | public: |
| 518 | const CWallet& wallet; |
| 519 | isminetype mine; |
| 520 | |
| 521 | explicit DescribeWalletBlindAddressVisitor(const CWallet& _wallet, isminetype mine_in) : wallet(_wallet), mine(mine_in) {} |
| 522 | |
| 523 | UniValue operator()(const CNoDestination& dest) const { return UniValue(UniValue::VOBJ); } |
| 524 | |
| 525 | UniValue operator()(const PKHash& pkhash) const |
| 526 | { |
| 527 | UniValue obj(UniValue::VOBJ); |
| 528 | if (!IsBlindDestination(pkhash) && mine != ISMINE_NO) { |
| 529 | CPubKey blind_pub = wallet.GetBlindingPubKey(GetScriptForDestination(pkhash)); |
| 530 | PKHash dest(pkhash); |
| 531 | dest.blinding_pubkey = blind_pub; |
| 532 | obj.pushKV("confidential", EncodeDestination(dest)); |
| 533 | } else { |
| 534 | obj.pushKV("confidential", EncodeDestination(pkhash)); |
| 535 | } |
| 536 | return obj; |
| 537 | } |
| 538 | |
| 539 | UniValue operator()(const ScriptHash& scripthash) const |
| 540 | { |
| 541 | UniValue obj(UniValue::VOBJ); |
| 542 | if (!IsBlindDestination(scripthash) && mine != ISMINE_NO) { |
| 543 | CPubKey blind_pub = wallet.GetBlindingPubKey(GetScriptForDestination(scripthash)); |
| 544 | ScriptHash dest(scripthash); |
| 545 | dest.blinding_pubkey = blind_pub; |
| 546 | obj.pushKV("confidential", EncodeDestination(dest)); |
| 547 | } else { |
| 548 | obj.pushKV("confidential", EncodeDestination(scripthash)); |
| 549 | } |
| 550 | return obj; |
| 551 | } |
| 552 | |
| 553 | UniValue operator()(const WitnessV0KeyHash& id) const |
| 554 | { |
| 555 | UniValue obj(UniValue::VOBJ); |
| 556 | if (!IsBlindDestination(id) && mine != ISMINE_NO) { |
| 557 | CPubKey blind_pub = wallet.GetBlindingPubKey(GetScriptForDestination(id)); |
| 558 | WitnessV0KeyHash dest(id); |
| 559 | dest.blinding_pubkey = blind_pub; |
| 560 | obj.pushKV("confidential", EncodeDestination(dest)); |
| 561 | } else { |
| 562 | obj.pushKV("confidential", EncodeDestination(id)); |
| 563 | } |
| 564 | return obj; |
| 565 | } |
| 566 | |
| 567 | UniValue operator()(const WitnessV0ScriptHash& id) const |
| 568 | { |
| 569 | UniValue obj(UniValue::VOBJ); |
| 570 | if (!IsBlindDestination(id) && mine != ISMINE_NO) { |
| 571 | CPubKey blind_pub = wallet.GetBlindingPubKey(GetScriptForDestination(id)); |
| 572 | WitnessV0ScriptHash dest(id); |
no outgoing calls
no test coverage detected