| 201 | } |
| 202 | |
| 203 | bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet) |
| 204 | { |
| 205 | vector<valtype> vSolutions; |
| 206 | txnouttype whichType; |
| 207 | if (!Solver(scriptPubKey, whichType, vSolutions)) |
| 208 | return false; |
| 209 | |
| 210 | if (whichType == TX_PUBKEY) |
| 211 | { |
| 212 | CPubKey pubKey(vSolutions[0]); |
| 213 | if (!pubKey.IsValid()) |
| 214 | return false; |
| 215 | |
| 216 | addressRet = pubKey.GetID(); |
| 217 | return true; |
| 218 | } |
| 219 | else if (whichType == TX_PUBKEYHASH) |
| 220 | { |
| 221 | addressRet = CKeyID(uint160(vSolutions[0])); |
| 222 | return true; |
| 223 | } |
| 224 | else if (whichType == TX_SCRIPTHASH) |
| 225 | { |
| 226 | addressRet = CScriptID(uint160(vSolutions[0])); |
| 227 | return true; |
| 228 | } |
| 229 | // Multisig txns have more than one address... |
| 230 | return false; |
| 231 | } |
| 232 | |
| 233 | bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, vector<CTxDestination>& addressRet, int& nRequiredRet) |
| 234 | { |