DropN removes the top N items from the stack. Stack transformation: DropN(1): [... x1 x2] -> [... x1] DropN(2): [... x1 x2] -> [...]
(n int32)
| 203 | // DropN(1): [... x1 x2] -> [... x1] |
| 204 | // DropN(2): [... x1 x2] -> [...] |
| 205 | func (s *stack) DropN(n int32) error { |
| 206 | if n < 1 { |
| 207 | str := fmt.Sprintf("attempt to drop %d items from stack", n) |
| 208 | return scriptError(ErrInvalidStackOperation, str) |
| 209 | } |
| 210 | |
| 211 | for ; n > 0; n-- { |
| 212 | _, err := s.PopByteArray() |
| 213 | if err != nil { |
| 214 | return err |
| 215 | } |
| 216 | } |
| 217 | return nil |
| 218 | } |
| 219 | |
| 220 | // DupN duplicates the top N items on the stack. |
| 221 | // |