0

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

monkeyUser
  • 960
  • 1
  • 7
  • 18
  • 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 May 20 '20 at 16:13
  • @PieterWuille thanks, in that case in impossible to execute the stack, because the transaction halts before it? – monkeyUser May 20 '20 at 16:14
  • 1
    Indeed. The script isn't even executed or looked at. – Pieter Wuille May 20 '20 at 16:15
  • How can I replicate a scenario where CLTV fails inside the stack? – monkeyUser May 20 '20 at 16:16
  • @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 May 20 '20 at 18:01
  • That sounds like what you wanted? – Pieter Wuille May 20 '20 at 18:06
  • @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 May 20 '20 at 18:41

0 Answers0