Sha256: b359653422ce3e41d591c0c2bc8d70508e80756350edda5cd86b4725cdc07607

Contents?: true

Size: 556 Bytes

Versions: 1

Compression:

Stored size: 556 Bytes

Contents

module Tapyrus
  module Message

    # tx message
    # https://bitcoin.org/en/developer-reference#tx
    class Tx < Base

      COMMAND = 'tx'

      attr_accessor :tx
      attr_accessor :use_segwit

      def initialize(tx, use_segwit = false)
        @tx = tx
        @use_segwit = use_segwit
      end

      def self.parse_from_payload(payload)
        tx = Tapyrus::Tx.parse_from_payload(payload)
        new(tx, tx.witness?)
      end

      def to_payload
        use_segwit ? tx.to_payload : tx.serialize_old_format
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tapyrus-0.1.0 lib/tapyrus/message/tx.rb