Sha256: 3d61b63e5cb42e0bb2cecbb4d42f0204bf291036534d10e09642a22ac9303209

Contents?: true

Size: 696 Bytes

Versions: 3

Compression:

Stored size: 696 Bytes

Contents

# encoding: ascii-8bit

module Bitcoin

  module Protocol

    class TxInWitness
      attr_reader :script_witness

      def initialize
        @script_witness = Bitcoin::Protocol::ScriptWitness.new
      end

      # add witness script to stack
      def add_stack(script)
        script_witness.stack << script
      end

      #  output witness script in raw binary format with witness
      def to_payload
        script_witness.to_payload
      end

      # get witness script stack
      def stack
        script_witness.stack
      end

      def self.from_hash(witnesses)
        w = TxInWitness.new
        witnesses.each{|item|w.add_stack(item)}
        w
      end

    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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