Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Coding Enthusiast on May 25, 2019, 05:07:58 AM



Title: Looking for nested if scripts for testing
Post by: Coding Enthusiast on May 25, 2019, 05:07:58 AM
Something like this would be great:
Code:
IF
  [statements]
  IF
     [statements]
  ELSE
     [statements]
  [statements]
ELSE
  [statements]

I can come up with tests myself but then I wouldn't know if it is actually correct (does bitcoin-core RPC work for checking?).
Checked bitcoin-core tests[1] but couldn't find any test cases for non-regular scripts, all of them seem to be for normal (standard) scripts used in regular transactions.

[1] https://github.com/bitcoin/bitcoin/blob/63b9efa73d6bec280241fe0fa06abf7e5b4dde8d/src/test/script_tests.cpp
and txcreatescript... files here https://github.com/bitcoin/bitcoin/tree/master/test/util/data


Title: Re: Looking for nested if scripts for testing
Post by: apxu on May 29, 2019, 05:47:09 PM
What about
Code:
OP_IF
  [statements]
OP_ELSE
  [statements]
OP_ELSE
  [statements]
OP_ELSE
  [statements]
OP_ELSE
  [statements]
OP_ENDIF