| 35 | using valtype = ranges::subrange<const unsigned char *>; |
| 36 | |
| 37 | static bool MatchPayToPubkey(const CScriptView& script, valtype& pubkey) |
| 38 | { |
| 39 | if (script.size() == CPubKey::PUBLIC_KEY_SIZE + 2 && script[0] == CPubKey::PUBLIC_KEY_SIZE && script.back() == OP_CHECKSIG) { |
| 40 | pubkey = valtype(script.begin() + 1, script.begin() + blocksci::CPubKey::PUBLIC_KEY_SIZE + 1); |
| 41 | return CPubKey::ValidSize(pubkey | ranges::to_vector); |
| 42 | } |
| 43 | if (script.size() == CPubKey::COMPRESSED_PUBLIC_KEY_SIZE + 2 && script[0] == CPubKey::COMPRESSED_PUBLIC_KEY_SIZE && script.back() == OP_CHECKSIG) { |
| 44 | pubkey = valtype(script.begin() + 1, script.begin() + CPubKey::COMPRESSED_PUBLIC_KEY_SIZE + 1); |
| 45 | return CPubKey::ValidSize(pubkey | ranges::to_vector); |
| 46 | } |
| 47 | return false; |
| 48 | } |
| 49 | |
| 50 | static bool MatchPayToPubkeyHash(const CScriptView& script, valtype& pubkeyhash) |
| 51 | { |
no test coverage detected