MCPcopy Index your code
hub / github.com/btcsuite/btcd / opcodeNumEqual

Function opcodeNumEqual

txscript/opcode.go:1628–1646  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1626// Stack transformation (x1==x2): [... 5 5] -> [... 1]
1627// Stack transformation (x1!=x2): [... 5 7] -> [... 0]
1628func 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//

Callers 1

opcodeNumEqualVerifyFunction · 0.85

Calls 3

scriptNumTypeAlias · 0.85
PopIntMethod · 0.80
PushIntMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…