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

Method PickN

txscript/stack.go:323–331  ·  view source on GitHub ↗

PickN copies the item N items back in the stack to the top. Stack transformation: PickN(0): [x1 x2 x3] -> [x1 x2 x3 x3] PickN(1): [x1 x2 x3] -> [x1 x2 x3 x2] PickN(2): [x1 x2 x3] -> [x1 x2 x3 x1]

(n int32)

Source from the content-addressed store, hash-verified

321// PickN(1): [x1 x2 x3] -> [x1 x2 x3 x2]
322// PickN(2): [x1 x2 x3] -> [x1 x2 x3 x1]
323func (s *stack) PickN(n int32) error {
324 so, err := s.PeekByteArray(n)
325 if err != nil {
326 return err
327 }
328 s.PushByteArray(so)
329
330 return nil
331}
332
333// RollN moves the item N items back in the stack to the top.
334//

Callers 2

TestStackFunction · 0.95
opcodePickFunction · 0.80

Calls 2

PeekByteArrayMethod · 0.95
PushByteArrayMethod · 0.95

Tested by 1

TestStackFunction · 0.76