Retrieves a public key for an address from the given FillableSigningProvider
| 218 | |
| 219 | // Retrieves a public key for an address from the given FillableSigningProvider |
| 220 | CPubKey AddrToPubKey(const FillableSigningProvider& keystore, const std::string& addr_in) |
| 221 | { |
| 222 | CTxDestination dest = DecodeDestination(addr_in); |
| 223 | if (!IsValidDestination(dest)) { |
| 224 | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address: " + addr_in); |
| 225 | } |
| 226 | CKeyID key = GetKeyForDestination(keystore, dest); |
| 227 | if (key.IsNull()) { |
| 228 | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("'%s' does not refer to a key", addr_in)); |
| 229 | } |
| 230 | CPubKey vchPubKey; |
| 231 | if (!keystore.GetPubKey(key, vchPubKey)) { |
| 232 | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("no full public key for address %s", addr_in)); |
| 233 | } |
| 234 | if (!vchPubKey.IsFullyValid()) { |
| 235 | throw JSONRPCError(RPC_INTERNAL_ERROR, "Wallet contains an invalid public key"); |
| 236 | } |
| 237 | return vchPubKey; |
| 238 | } |
| 239 | |
| 240 | // Creates a multisig address from a given list of public keys, number of signatures required, and the address type |
| 241 | CTxDestination AddAndGetMultisigDestination(const int required, const std::vector<CPubKey>& pubkeys, OutputType type, FillableSigningProvider& keystore, CScript& script_out) |