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

Method PeekByteArray

txscript/stack.go:106–115  ·  view source on GitHub ↗

PeekByteArray returns the Nth item on the stack without removing it.

(idx int32)

Source from the content-addressed store, hash-verified

104
105// PeekByteArray returns the Nth item on the stack without removing it.
106func (s *stack) PeekByteArray(idx int32) ([]byte, error) {
107 sz := int32(len(s.stk))
108 if idx < 0 || idx >= sz {
109 str := fmt.Sprintf("index %d is invalid for stack size %d", idx,
110 sz)
111 return nil, scriptError(ErrInvalidStackOperation, str)
112 }
113
114 return s.stk[sz-idx-1], nil
115}
116
117// PeekInt returns the Nth item on the stack as a script num without removing
118// it. The act of converting to a script num enforces the consensus rules

Callers 11

TestStackFunction · 0.95
PeekIntMethod · 0.95
PeekBoolMethod · 0.95
DupNMethod · 0.95
OverNMethod · 0.95
PickNMethod · 0.95
getStackFunction · 0.80
opcodeIfDupFunction · 0.80
opcodeSizeFunction · 0.80

Calls 1

scriptErrorFunction · 0.85

Tested by 1

TestStackFunction · 0.76