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

Method Tuck

txscript/stack.go:184–198  ·  view source on GitHub ↗

Tuck copies the item at the top of the stack and inserts it before the 2nd to top item. Stack transformation: [... x1 x2] -> [... x2 x1 x2]

()

Source from the content-addressed store, hash-verified

182//
183// Stack transformation: [... x1 x2] -> [... x2 x1 x2]
184func (s *stack) Tuck() error {
185 so2, err := s.PopByteArray()
186 if err != nil {
187 return err
188 }
189 so1, err := s.PopByteArray()
190 if err != nil {
191 return err
192 }
193 s.PushByteArray(so2) // stack [... x2]
194 s.PushByteArray(so1) // stack [... x2 x1]
195 s.PushByteArray(so2) // stack [... x2 x1 x2]
196
197 return nil
198}
199
200// DropN removes the top N items from the stack.
201//

Callers 2

TestStackFunction · 0.95
opcodeTuckFunction · 0.80

Calls 2

PopByteArrayMethod · 0.95
PushByteArrayMethod · 0.95

Tested by 1

TestStackFunction · 0.76