MCPcopy
hub / github.com/btcsuite/btcd / opcodeSub

Function opcodeSub

txscript/opcode.go:1554–1567  ·  view source on GitHub ↗

opcodeSub treats the top two items on the data stack as integers and replaces them with the result of subtracting the top entry from the second-to-top entry. Stack transformation: [... x1 x2] -> [... x1-x2]

(op *opcode, data []byte, vm *Engine)

Source from the content-addressed store, hash-verified

1552//
1553// Stack transformation: [... x1 x2] -> [... x1-x2]
1554func opcodeSub(op *opcode, data []byte, vm *Engine) error {
1555 v0, err := vm.dstack.PopInt()
1556 if err != nil {
1557 return err
1558 }
1559
1560 v1, err := vm.dstack.PopInt()
1561 if err != nil {
1562 return err
1563 }
1564
1565 vm.dstack.PushInt(v1 - v0)
1566 return nil
1567}
1568
1569// opcodeBoolAnd treats the top two items on the data stack as integers. When
1570// both of them are not zero, they are replaced with a 1, otherwise a 0.

Callers

nothing calls this directly

Calls 2

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…