1 #ifndef LIGHTNING_COMMON_SHUTDOWN_SCRIPTPUBKEY_H
2 #define LIGHTNING_COMMON_SHUTDOWN_SCRIPTPUBKEY_H
3 #include "config.h"
4 #include <ccan/short_types/short_types.h>
5 
6 /* BOLT #2:
7  *
8  * 1. `OP_DUP` `OP_HASH160` `20` 20-bytes `OP_EQUALVERIFY` `OP_CHECKSIG`
9  *   (pay to pubkey hash), OR
10  * 2. `OP_HASH160` `20` 20-bytes `OP_EQUAL` (pay to script hash), OR
11  * 3. `OP_0` `20` 20-bytes (version 0 pay to witness pubkey hash), OR
12  * 4. `OP_0` `32` 32-bytes (version 0 pay to witness script hash), OR
13  * 5. if (and only if) `option_shutdown_anysegwit` is negotiated:
14  *    * `OP_1` through `OP_16` inclusive, followed by a single push of 2 to 40 bytes
15  *    (witness program versions 1 through 16)
16  *
17  * A receiving node:
18  *...
19  *  - if the `scriptpubkey` is not in one of the above forms:
20  *    - SHOULD fail the connection.
21  */
22 bool valid_shutdown_scriptpubkey(const u8 *scriptpubkey,
23 				 bool anysegwit);
24 
25 #endif /* LIGHTNING_COMMON_SHUTDOWN_SCRIPTPUBKEY_H */
26