From 114b7afbe2a86119afe848528656daeeb623c1dc Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 8 Jun 2015 09:26:14 +0930 Subject: [PATCH] bitcoin_script: fix bug in complex anchor redeem script. We need to pop off the stack after OP_CHECKSEQUENCEVERIFY. Signed-off-by: Rusty Russell --- bitcoin_script.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bitcoin_script.c b/bitcoin_script.c index 9ad8bce6e..57e719b16 100644 --- a/bitcoin_script.c +++ b/bitcoin_script.c @@ -17,6 +17,7 @@ #define OP_ELSE 0x67 #define OP_ENDIF 0x68 #define OP_DEPTH 0x74 +#define OP_DROP 0x75 #define OP_DUP 0x76 #define OP_EQUAL 0x87 #define OP_EQUALVERIFY 0x88 @@ -377,6 +378,7 @@ u8 *bitcoin_redeem_revocable(const tal_t *ctx, add_op(&script, OP_ELSE); add_push_bytes(&script, &locktime_le, sizeof(locktime_le)); 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);