From cf3433a0ad8ba3048f1691f935b7d8b17f2b35f2 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 7 Aug 2015 12:45:30 +0930 Subject: [PATCH] script: add OP_CHECKLOCKTIMEVERIFY. Signed-off-by: Rusty Russell --- Makefile | 4 ++-- bitcoin/script.c | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index dba21f545..ac39ea5aa 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,8 @@ # Needs to have oneof support: Ubuntu vivid's is too old :( PROTOCC:=protoc-c -# Alpha has checksequenceverify, segregated witness+input-amount-in-sig+confidentual-transactions, schnorr -FEATURES := -DHAS_CSV=1 -DALPHA_TXSTYLE=1 -DUSE_SCHNORR=1 +# Alpha has checksequenceverify, segregated witness+input-amount-in-sig+confidentual-transactions, schnorr, checklocktimeverify +FEATURES := -DHAS_CSV=1 -DALPHA_TXSTYLE=1 -DUSE_SCHNORR=1 -DHAS_CLTV=1 # Bitcoin uses DER for signatures #FEATURES := -DSCRIPTS_USE_DER diff --git a/bitcoin/script.c b/bitcoin/script.c index 03cb07606..cc6c3b779 100644 --- a/bitcoin/script.c +++ b/bitcoin/script.c @@ -33,6 +33,14 @@ /* OP_NOP, otherwise bitcoind complains */ #define OP_CHECKSEQUENCEVERIFY 0x61 #endif + +#ifdef HAS_CLTV +#define OP_CHECKLOCKTIMEVERIFY 0xB1 +#else +/* OP_NOP, otherwise bitcoind complains */ +#define OP_CHECKLOCKTIMEVERIFY 0x61 +#endif + static void add(u8 **scriptp, const void *mem, size_t len) { size_t oldlen = tal_count(*scriptp);