lib/bitcoin/script.rb
# The item n back in the stack is moved to the top.
The item n back in the stack is moved to the top.
The item n back in the stack is moved to the top .
def op_roll
    return invalid if @stack.size < 2
    pos = pop_int
    return invalid if (pos < 0) || (pos >= @stack.size)
    idx = -(pos+1)
    item = @stack[idx]
    if item
      @stack.delete_at(idx)
      @stack << item if item
    end
  end
def op_roll return invalid if @stack . size < 2 pos = pop_int return invalid if ( pos < 0 ) || ( pos >= @stack . size ) idx = - ( pos + 1 ) item = @stack [ idx ] if item @stack . delete_at ( idx ) @stack << item if item end end
The item n back in the stack is moved to the top.
The item n back in the stack is moved to the top .