diff --git a/bitcoin/script.c b/bitcoin/script.c index 8acde8a23..54c53d82e 100644 --- a/bitcoin/script.c +++ b/bitcoin/script.c @@ -10,6 +10,9 @@ #include #include +/* To push 0-75 bytes onto stack. */ +#define OP_PUSHBYTES(val) (val) + /* Bitcoin's OP_HASH160 is RIPEMD(SHA256()) */ static void hash160(struct ripemd160 *redeemhash, const void *mem, size_t len) { diff --git a/bitcoin/script.h b/bitcoin/script.h index c7fd73cb5..660c83ad6 100644 --- a/bitcoin/script.h +++ b/bitcoin/script.h @@ -13,9 +13,6 @@ struct ripemd160; struct rel_locktime; struct abs_locktime; -/* To push 0-75 bytes onto stack. */ -#define OP_PUSHBYTES(val) (val) - /* tal_count() gives the length of the script. */ u8 *bitcoin_redeem_2of2(const tal_t *ctx, const struct pubkey *key1, diff --git a/bitcoin/tx.c b/bitcoin/tx.c index 62a1d249a..d86b53c94 100644 --- a/bitcoin/tx.c +++ b/bitcoin/tx.c @@ -324,16 +324,6 @@ const u8 *bitcoin_tx_output_get_script(const tal_t *ctx, return cln_wally_tx_output_get_script(ctx, output); } -bool bitcoin_tx_output_script_is_p2wsh(const struct bitcoin_tx *tx, int outnum) -{ const struct wally_tx_output *output; - assert(outnum < tx->wtx->num_outputs); - output = &tx->wtx->outputs[outnum]; - - return output->script_len == BITCOIN_SCRIPTPUBKEY_P2WSH_LEN && - output->script[0] == OP_0 && - output->script[1] == OP_PUSHBYTES(sizeof(struct sha256)); -} - u8 *bitcoin_tx_output_get_witscript(const tal_t *ctx, const struct bitcoin_tx *tx, int outnum) { diff --git a/bitcoin/tx.h b/bitcoin/tx.h index 849db6305..091ecb476 100644 --- a/bitcoin/tx.h +++ b/bitcoin/tx.h @@ -154,14 +154,6 @@ void bitcoin_tx_output_set_amount(struct bitcoin_tx *tx, int outnum, */ const u8 *bitcoin_tx_output_get_script(const tal_t *ctx, const struct bitcoin_tx *tx, int outnum); -/** - * Return `true` if the given output is a P2WSH output. - * - * This is useful if you want to peek at the script, without having to - * extract it first. - */ -bool bitcoin_tx_output_script_is_p2wsh(const struct bitcoin_tx *tx, int outnum); - /** * Helper to get the script of a script's output as a tal_arr *