<p>I create a transaction with <code>OP_CHECKLOCKTIMEVERIFY</code>. The median time is not greater than my date that I set in my witness script, for that reason if I try to send it I receive:</p>

<pre><code>error code: -26
error message:
non-final (code 64)
</code></pre>

<p>I'd like to understand how stack works, and I tried with btcdeb. Below my stack</p>

<pre><code>script                                                             |                                                             stack 
-------------------------------------------------------------------+-------------------------------------------------------------------
0439c55e                                                           | 3044022031b0e07db908a1b208551aa66b40350e84493677d05ea90fc6ac23f...
OP_CHECKLOCKTIMEVERIFY                                             | 0x
OP_DROP                                                            | 
1                                                                  | 
02930f63741e00c95a713ecdf3b8b9e0e87881381cba69541ba8a483eb30c8ba94 | 
03c9e8dd40cc9fc523823171a603197857a5f9718f679bd5c1a0cf68c06db10435 | 
02c70779c5685e46e6fb098d6ccc3ae040a85c6e19a3890cc255504edf87d98936 | 
3                                                                  | 
OP_CHECKMULTISIG                                                   | 
#0000 0439c55e
btcdeb&gt; step
        &lt;&gt; PUSH stack 0439c55e
script                                                             |                                                             stack 
-------------------------------------------------------------------+-------------------------------------------------------------------
OP_CHECKLOCKTIMEVERIFY                                             |                                                           0439c55e
OP_DROP                                                            | 3044022031b0e07db908a1b208551aa66b40350e84493677d05ea90fc6ac23f...
1                                                                  | 0x
02930f63741e00c95a713ecdf3b8b9e0e87881381cba69541ba8a483eb30c8ba94 | 
03c9e8dd40cc9fc523823171a603197857a5f9718f679bd5c1a0cf68c06db10435 | 
02c70779c5685e46e6fb098d6ccc3ae040a85c6e19a3890cc255504edf87d98936 | 
3                                                                  | 
OP_CHECKMULTISIG                                                   | 
#0001 OP_CHECKLOCKTIMEVERIFY
btcdeb&gt; step
script                                                             |                                                             stack 
-------------------------------------------------------------------+-------------------------------------------------------------------
OP_DROP                                                            |                                                           0439c55e
1                                                                  | 3044022031b0e07db908a1b208551aa66b40350e84493677d05ea90fc6ac23f...
02930f63741e00c95a713ecdf3b8b9e0e87881381cba69541ba8a483eb30c8ba94 | 0x
03c9e8dd40cc9fc523823171a603197857a5f9718f679bd5c1a0cf68c06db10435 | 
02c70779c5685e46e6fb098d6ccc3ae040a85c6e19a3890cc255504edf87d98936 | 
3                                                                  | 
OP_CHECKMULTISIG                                                   | 
#0002 OP_DROP
btcdeb&gt; step
        &lt;&gt; POP  stack
script                                                             |                                                             stack 
-------------------------------------------------------------------+-------------------------------------------------------------------
1                                                                  | 3044022031b0e07db908a1b208551aa66b40350e84493677d05ea90fc6ac23f...
02930f63741e00c95a713ecdf3b8b9e0e87881381cba69541ba8a483eb30c8ba94 | 0x
03c9e8dd40cc9fc523823171a603197857a5f9718f679bd5c1a0cf68c06db10435 | 
02c70779c5685e46e6fb098d6ccc3ae040a85c6e19a3890cc255504edf87d98936 | 
3                                                                  | 
OP_CHECKMULTISIG                                                   | 
#0003 1
</code></pre>

<p>OP_CHECKLOCKTIMEVERIFY is not satisfied but the stack is still valid. I thought that when OP_CHECKLOCKTIMEVERIFY check 0439c55e, mark the transaction invalid and exit form the stack</p>

CC BY-SA 4.0
2020-05-20T16:13:16.210Z
The non-final error has nothing to do with script. It means you have a locktime or nsequence value in that prevents the transaction from being included in the next block.
Pieter Wuille
CC BY-SA 4.0
2020-05-20T16:14:35.400Z
@PieterWuille thanks, in that case in impossible to execute the stack, because the transaction halts before it?
monkeyUser
CC BY-SA 4.0
2020-05-20T16:15:07.090Z
Indeed. The script isn't even executed or looked at.
Pieter Wuille
CC BY-SA 4.0
2020-05-20T16:16:02.143Z
How can I replicate a scenario where CLTV fails inside the stack?
monkeyUser
CC BY-SA 4.0
2020-05-20T18:01:58.127Z
@PieterWuille Ok , I need to set locktime lower than OP_CLTV in oder to get `error: Locktime requirement not satisfied` during execute the stack.
monkeyUser
CC BY-SA 4.0
2020-05-20T18:06:06.773Z
That sounds like what you wanted?
Pieter Wuille
CC BY-SA 4.0
2020-05-20T18:41:44.647Z
@PieterWuille yes. First step check locktime with median time, after that check OP_CHECKLOCKTIMEVERIFY with nlocktime. the date value of OP_CHECKLOCKTIMEVERIFY must be equal locktime and greater than median time, right?
monkeyUser
<transactions><btcd>
btcdeb and OP_CHECKLOCKTIMEVERIFY
monkeyUser
# btcdeb and OP_CHECKLOCKTIMEVERIFY

(Asked by: username_0 on 2020-05-20)

I create a transaction with `OP_CHECKLOCKTIMEVERIFY`. The median time is not greater than my date that I set in my witness script, for that reason if I try to send it I receive:

```
error code: -26
error message:
non-final (code 64)

```

I'd like to understand how stack works, and I tried with btcdeb. Below my stack

```
script                                                             |                                                             stack 
-------------------------------------------------------------------+-------------------------------------------------------------------
0439c55e                                                           | 3044022031b0e07db908a1b208551aa66b40350e84493677d05ea90fc6ac23f...
OP_CHECKLOCKTIMEVERIFY                                             | 0x
OP_DROP                                                            | 
1                                                                  | 
02930f63741e00c95a713ecdf3b8b9e0e87881381cba69541ba8a483eb30c8ba94 | 
03c9e8dd40cc9fc523823171a603197857a5f9718f679bd5c1a0cf68c06db10435 | 
02c70779c5685e46e6fb098d6ccc3ae040a85c6e19a3890cc255504edf87d98936 | 
3                                                                  | 
OP_CHECKMULTISIG                                                   | 
#0000 0439c55e
btcdeb> step
        <> PUSH stack 0439c55e
script                                                             |                                                             stack 
-------------------------------------------------------------------+-------------------------------------------------------------------
OP_CHECKLOCKTIMEVERIFY                                             |                                                           0439c55e
OP_DROP                                                            | 3044022031b0e07db908a1b208551aa66b40350e84493677d05ea90fc6ac23f...
1                                                                  | 0x
02930f63741e00c95a713ecdf3b8b9e0e87881381cba69541ba8a483eb30c8ba94 | 
03c9e8dd40cc9fc523823171a603197857a5f9718f679bd5c1a0cf68c06db10435 | 
02c70779c5685e46e6fb098d6ccc3ae040a85c6e19a3890cc255504edf87d98936 | 
3                                                                  | 
OP_CHECKMULTISIG                                                   | 
#0001 OP_CHECKLOCKTIMEVERIFY
btcdeb> step
script                                                             |                                                             stack 
-------------------------------------------------------------------+-------------------------------------------------------------------
OP_DROP                                                            |                                                           0439c55e
1                                                                  | 3044022031b0e07db908a1b208551aa66b40350e84493677d05ea90fc6ac23f...
02930f63741e00c95a713ecdf3b8b9e0e87881381cba69541ba8a483eb30c8ba94 | 0x
03c9e8dd40cc9fc523823171a603197857a5f9718f679bd5c1a0cf68c06db10435 | 
02c70779c5685e46e6fb098d6ccc3ae040a85c6e19a3890cc255504edf87d98936 | 
3                                                                  | 
OP_CHECKMULTISIG                                                   | 
#0002 OP_DROP
btcdeb> step
        <> POP  stack
script                                                             |                                                             stack 
-------------------------------------------------------------------+-------------------------------------------------------------------
1                                                                  | 3044022031b0e07db908a1b208551aa66b40350e84493677d05ea90fc6ac23f...
02930f63741e00c95a713ecdf3b8b9e0e87881381cba69541ba8a483eb30c8ba94 | 0x
03c9e8dd40cc9fc523823171a603197857a5f9718f679bd5c1a0cf68c06db10435 | 
02c70779c5685e46e6fb098d6ccc3ae040a85c6e19a3890cc255504edf87d98936 | 
3                                                                  | 
OP_CHECKMULTISIG                                                   | 
#0003 1

```

OP\_CHECKLOCKTIMEVERIFY is not satisfied but the stack is still valid. I thought that when OP\_CHECKLOCKTIMEVERIFY check 0439c55e, mark the transaction invalid and exit form the stack

**Tags:** transactions, btcd

> **Comments:**
> **username_1**: The non-final error has nothing to do with script. It means you have a locktime or nsequence value in that prevents the transaction from being included in the next block.  
> **username_0**: @username_1 thanks, in that case in impossible to execute the stack, because the transaction halts before it?  
> **username_1**: Indeed. The script isn't even executed or looked at.  
> **username_0**: How can I replicate a scenario where CLTV fails inside the stack?  
> **username_0**: @username_1 Ok , I need to set locktime lower than OP_CLTV in oder to get `error: Locktime requirement not satisfied` during execute the stack.  
> **username_1**: That sounds like what you wanted?  
> **username_0**: @username_1 yes. First step check locktime with median time, after that check OP_CHECKLOCKTIMEVERIFY with nlocktime. the date value of OP_CHECKLOCKTIMEVERIFY must be equal locktime and greater than median time, right?  

---

## 0 answers

