Sha256: 6c33fc80d30b73f122b5bb0dfc009743b5d8d74bcf80b1ac98f3ade00582252c

Contents?: true

Size: 404 Bytes

Versions: 10

Compression:

Stored size: 404 Bytes

Contents

module Bitcoin

  # witness
  class ScriptWitness

    attr_reader :stack

    def initialize(stack = [])
      @stack = stack
    end

    def empty?
      stack.empty?
    end

    def to_payload
      p = Bitcoin.pack_var_int(stack.size)
      p << stack.map { |s|
        Bitcoin.pack_var_int(s.bytesize) << s
      }.join
    end

    def to_s
      stack.map{|s|s.bth}.join(' ')
    end

  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
bitcoinrb-0.1.9 lib/bitcoin/script_witness.rb
bitcoinrb-0.1.8 lib/bitcoin/script_witness.rb
bitcoinrb-0.1.7 lib/bitcoin/script_witness.rb
bitcoinrb-0.1.6 lib/bitcoin/script_witness.rb
bitcoinrb-0.1.5 lib/bitcoin/script_witness.rb
bitcoinrb-0.1.4 lib/bitcoin/script_witness.rb
bitcoinrb-0.1.3 lib/bitcoin/script_witness.rb
bitcoinrb-0.1.2 lib/bitcoin/script_witness.rb
bitcoinrb-0.1.1 lib/bitcoin/script_witness.rb
bitcoinrb-0.0.1 lib/bitcoin/script_witness.rb