| 42 | } |
| 43 | |
| 44 | static bool MatchPayToPubkey(const CScript& script, valtype& pubkey) |
| 45 | { |
| 46 | if (script.size() == CPubKey::PUBLIC_KEY_SIZE + 2 && script[0] == CPubKey::PUBLIC_KEY_SIZE && script.back() == OP_CHECKSIG) { |
| 47 | pubkey = valtype(script.begin() + 1, script.begin() + CPubKey::PUBLIC_KEY_SIZE + 1); |
| 48 | return CPubKey::ValidSize(pubkey); |
| 49 | } |
| 50 | if (script.size() == CPubKey::COMPRESSED_PUBLIC_KEY_SIZE + 2 && script[0] == CPubKey::COMPRESSED_PUBLIC_KEY_SIZE && script.back() == OP_CHECKSIG) { |
| 51 | pubkey = valtype(script.begin() + 1, script.begin() + CPubKey::COMPRESSED_PUBLIC_KEY_SIZE + 1); |
| 52 | return CPubKey::ValidSize(pubkey); |
| 53 | } |
| 54 | return false; |
| 55 | } |
| 56 | |
| 57 | static bool MatchPayToPubkeyHash(const CScript& script, valtype& pubkeyhash) |
| 58 | { |