bitcoin: remove unused scriptpubkey_opreturn_padded.
What changed, and why it matters
This commit simply removes an unused helper function that created random padding for Bitcoin-style data scripts. There is no security fix or vulnerability here—just cleanup of dead code that happened to pull in randomness routines.
No security action needed. Treat as routine code cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch deletes scriptpubkey_opreturn_padded() from bitcoin/script.c and its prototype/comment from bitcoin/script.h. The function generated a 20-byte random payload inside an OP_RETURN output. The commit message states it was unused and removed because it pulled in randomness routines. No callers are modified, consistent with it being dead code. No security-relevant behavior changes.
Changed components
bitcoin/script.cbitcoin/script.hInspect captured patch +0 / −17
diff --git a/bitcoin/script.c b/bitcoin/script.c
index 73367f5b..1c703dbb 100644
--- a/bitcoin/script.c
+++ b/bitcoin/script.c
@@ -187,17 +187,6 @@ u8 *scriptpubkey_p2pkh(const tal_t *ctx, const struct bitcoin_address *addr)
return script;
}
-u8 *scriptpubkey_opreturn_padded(const tal_t *ctx)
-{
- u8 *script = tal_arr(ctx, u8, 0);
- u8 random[20];
- randombytes_buf(random, sizeof(random));
-
- add_op(&script, OP_RETURN);
- script_push_bytes(&script, random, sizeof(random));
- return script;
-}
-
/* Create an input script which spends p2pkh */
u8 *bitcoin_redeem_p2pkh(const tal_t *ctx, const struct pubkey *pubkey,
const struct bitcoin_signature *sig)
diff --git a/bitcoin/script.h b/bitcoin/script.h
index ccbad3bf..52be6626 100644
--- a/bitcoin/script.h
+++ b/bitcoin/script.h
@@ -26,12 +26,6 @@ u8 *scriptpubkey_p2sh_hash(const tal_t *ctx, const struct ripemd160 *redeemhash)
/* Create an output script using p2pkh */
u8 *scriptpubkey_p2pkh(const tal_t *ctx, const struct bitcoin_address *addr);
-/* Create a prunable output script with 20 random bytes.
- * This is needed since a spend from a p2wpkh to an `OP_RETURN` without
- * any other outputs would result in a transaction smaller than the
- * minimum size. */
-u8 *scriptpubkey_opreturn_padded(const tal_t *ctx);
-
/* Create an input script which spends p2pkh */
u8 *bitcoin_redeem_p2pkh(const tal_t *ctx, const struct pubkey *pubkey,
const struct bitcoin_signature *sig);
Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.