PeekByteArray returns the Nth item on the stack without removing it.
(idx int32)
| 104 | |
| 105 | // PeekByteArray returns the Nth item on the stack without removing it. |
| 106 | func (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 |