Returns a Bitcoin script that compares two elements of length `n`. The script consumes its inputs. If the two elements are not equal, then the script fails immediately.
(n: usize)
| 409 | /// The script consumes its inputs. |
| 410 | /// If the two elements are not equal, then the script fails immediately. |
| 411 | fn equalverify(n: usize) -> Script { |
| 412 | script!( |
| 413 | for _ in 0..n { |
| 414 | OP_TOALTSTACK |
| 415 | } |
| 416 | |
| 417 | for i in 1..n { |
| 418 | {i} |
| 419 | OP_ROLL |
| 420 | } |
| 421 | |
| 422 | for _ in 0..n { |
| 423 | OP_FROMALTSTACK |
| 424 | OP_EQUALVERIFY |
| 425 | } |
| 426 | ) |
| 427 | } |
| 428 | |
| 429 | /// Convert the raw Bitcoin witness into a byte vector. |
| 430 | /// |
no outgoing calls