| 476 | } |
| 477 | |
| 478 | bool is_p2pkh(const u8 *script, size_t script_len, struct bitcoin_address *addr) |
| 479 | { |
| 480 | if (script_len != BITCOIN_SCRIPTPUBKEY_P2PKH_LEN) |
| 481 | return false; |
| 482 | if (script[0] != OP_DUP) |
| 483 | return false; |
| 484 | if (script[1] != OP_HASH160) |
| 485 | return false; |
| 486 | if (script[2] != OP_PUSHBYTES(20)) |
| 487 | return false; |
| 488 | if (script[23] != OP_EQUALVERIFY) |
| 489 | return false; |
| 490 | if (script[24] != OP_CHECKSIG) |
| 491 | return false; |
| 492 | if (addr) |
| 493 | memcpy(addr, script+3, 20); |
| 494 | return true; |
| 495 | } |
| 496 | |
| 497 | bool is_p2sh(const u8 *script, size_t script_len, struct ripemd160 *addr) |
| 498 | { |
no outgoing calls
no test coverage detected