Sha256: bd80be412e705b9ff0d811c9b791bf4516ebccb0a37b57b15d1ef3cf8ba81430

Contents?: true

Size: 573 Bytes

Versions: 2

Compression:

Stored size: 573 Bytes

Contents

# encoding: ascii-8bit

module Bitcoin
  module Protocol
    # TxWitness section of https://en.bitcoin.it/wiki/Protocol_documentation#tx
    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)
        payload << stack.map { |e| Bitcoin::Protocol.pack_var_int(e.bytesize) << e }.join
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bitcoin-ruby-0.0.20 lib/bitcoin/protocol/script_witness.rb
bitcoin-ruby-0.0.19 lib/bitcoin/protocol/script_witness.rb