Sha256: a045d2fe0f900244796d576941e5e03117b978080380487c20d0afa37e441a0d

Contents?: true

Size: 552 Bytes

Versions: 3

Compression:

Stored size: 552 Bytes

Contents

# encoding: ascii-8bit

module Bitcoin

  module Protocol

    class ScriptWitness

      # witness stack
      attr_reader :stack

      def initialize
        @stack = []
      end

      # check empty
      def empty?
        stack.empty?
      end

      # output script in raw binary format
      def to_payload
        payload = Bitcoin::Protocol.pack_var_int(stack.size)
        stack.each{|e|
          payload << Bitcoin::Protocol.pack_var_int(e.htb.bytesize)
          payload << e.htb
        }
        payload
      end

    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
openassets-ruby-0.6.4 lib/segwit/script_witness.rb
openassets-ruby-0.6.3 lib/segwit/script_witness.rb
openassets-ruby-0.6.2 lib/segwit/script_witness.rb