opcodeNumEqual treats the top two items on the data stack as integers. When they are equal, they are replaced with a 1, otherwise a 0. Stack transformation (x1==x2): [... 5 5] -> [... 1] Stack transformation (x1!=x2): [... 5 7] -> [... 0]
(op *opcode, data []byte, vm *Engine)
| 1626 | // Stack transformation (x1==x2): [... 5 5] -> [... 1] |
| 1627 | // Stack transformation (x1!=x2): [... 5 7] -> [... 0] |
| 1628 | func opcodeNumEqual(op *opcode, data []byte, vm *Engine) error { |
| 1629 | v0, err := vm.dstack.PopInt() |
| 1630 | if err != nil { |
| 1631 | return err |
| 1632 | } |
| 1633 | |
| 1634 | v1, err := vm.dstack.PopInt() |
| 1635 | if err != nil { |
| 1636 | return err |
| 1637 | } |
| 1638 | |
| 1639 | if v0 == v1 { |
| 1640 | vm.dstack.PushInt(scriptNum(1)) |
| 1641 | } else { |
| 1642 | vm.dstack.PushInt(scriptNum(0)) |
| 1643 | } |
| 1644 | |
| 1645 | return nil |
| 1646 | } |
| 1647 | |
| 1648 | // opcodeNumEqualVerify is a combination of opcodeNumEqual and opcodeVerify. |
| 1649 | // |
no test coverage detected
searching dependent graphs…