From 143e7e032cc8882b16038236a8783c798ee9e0dd Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 23 Jun 2015 16:05:09 +0930 Subject: [PATCH] Optimize revocable output a little. Both paths do CHECKSIG, do that outside. Signed-off-by: Rusty Russell --- bitcoin/script.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bitcoin/script.c b/bitcoin/script.c index 013936ea5..fca3189f2 100644 --- a/bitcoin/script.c +++ b/bitcoin/script.c @@ -361,7 +361,6 @@ u8 *bitcoin_redeem_revocable(const tal_t *ctx, add_push_bytes(&script, rhash_ripemd, sizeof(rhash_ripemd)); add_op(&script, OP_EQUALVERIFY); add_push_key(&script, theirkey); - add_op(&script, OP_CHECKSIG); /* Not two args? Must be us using timeout. */ add_op(&script, OP_ELSE); @@ -370,9 +369,11 @@ u8 *bitcoin_redeem_revocable(const tal_t *ctx, add_op(&script, OP_CHECKSEQUENCEVERIFY); add_op(&script, OP_DROP); add_push_key(&script, mykey); - add_op(&script, OP_CHECKSIG); add_op(&script, OP_ENDIF); + /* And check it (ither path) */ + add_op(&script, OP_CHECKSIG); + return script; }