| 1132 | } |
| 1133 | |
| 1134 | class DescribeBlindAddressVisitor |
| 1135 | { |
| 1136 | public: |
| 1137 | |
| 1138 | explicit DescribeBlindAddressVisitor() {} |
| 1139 | |
| 1140 | UniValue operator()(const CNoDestination& dest) const { return UniValue(UniValue::VOBJ); } |
| 1141 | |
| 1142 | UniValue operator()(const PKHash& pkhash) const |
| 1143 | { |
| 1144 | UniValue obj(UniValue::VOBJ); |
| 1145 | const CPubKey& blind_pub = pkhash.blinding_pubkey; |
| 1146 | if (IsBlindDestination(pkhash)) { |
| 1147 | obj.pushKV("confidential_key", HexStr(blind_pub)); |
| 1148 | PKHash unblinded(pkhash); |
| 1149 | unblinded.blinding_pubkey = CPubKey(); |
| 1150 | obj.pushKV("unconfidential", EncodeDestination(unblinded)); |
| 1151 | } else { |
| 1152 | obj.pushKV("confidential_key", ""); |
| 1153 | obj.pushKV("unconfidential", EncodeDestination(pkhash)); |
| 1154 | } |
| 1155 | return obj; |
| 1156 | } |
| 1157 | |
| 1158 | UniValue operator()(const ScriptHash& scripthash) const |
| 1159 | { |
| 1160 | UniValue obj(UniValue::VOBJ); |
| 1161 | const CPubKey& blind_pub = scripthash.blinding_pubkey; |
| 1162 | if (IsBlindDestination(scripthash)) { |
| 1163 | obj.pushKV("confidential_key", HexStr(blind_pub)); |
| 1164 | ScriptHash unblinded(scripthash); |
| 1165 | unblinded.blinding_pubkey = CPubKey(); |
| 1166 | obj.pushKV("unconfidential", EncodeDestination(unblinded)); |
| 1167 | } else { |
| 1168 | obj.pushKV("confidential_key", ""); |
| 1169 | obj.pushKV("unconfidential", EncodeDestination(scripthash)); |
| 1170 | } |
| 1171 | |
| 1172 | return obj; |
| 1173 | } |
| 1174 | |
| 1175 | UniValue operator()(const WitnessV0KeyHash& id) const |
| 1176 | { |
| 1177 | UniValue obj(UniValue::VOBJ); |
| 1178 | const CPubKey& blind_pub = id.blinding_pubkey; |
| 1179 | if (IsBlindDestination(id)) { |
| 1180 | obj.pushKV("confidential_key", HexStr(blind_pub)); |
| 1181 | WitnessV0KeyHash unblinded(id); |
| 1182 | unblinded.blinding_pubkey = CPubKey(); |
| 1183 | obj.pushKV("unconfidential", EncodeDestination(unblinded)); |
| 1184 | } else { |
| 1185 | obj.pushKV("confidential_key", ""); |
| 1186 | obj.pushKV("unconfidential", EncodeDestination(id)); |
| 1187 | } |
| 1188 | |
| 1189 | return obj; |
| 1190 | } |
| 1191 |
no outgoing calls
no test coverage detected