Sha256: 5baf5fdc4e66d421e22438cb3d4fb034c1338fcc2a33f40bad7643dfc9dcd061

Contents?: true

Size: 556 Bytes

Versions: 26

Compression:

Stored size: 556 Bytes

Contents

module Bitcoin
  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 = Bitcoin::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

26 entries across 26 versions & 1 rubygems

Version Path
bitcoinrb-0.7.0 lib/bitcoin/message/tx.rb
bitcoinrb-0.6.0 lib/bitcoin/message/tx.rb
bitcoinrb-0.5.0 lib/bitcoin/message/tx.rb
bitcoinrb-0.4.0 lib/bitcoin/message/tx.rb
bitcoinrb-0.3.2 lib/bitcoin/message/tx.rb
bitcoinrb-0.3.1 lib/bitcoin/message/tx.rb
bitcoinrb-0.3.0 lib/bitcoin/message/tx.rb
bitcoinrb-0.2.9 lib/bitcoin/message/tx.rb
bitcoinrb-0.2.8 lib/bitcoin/message/tx.rb
bitcoinrb-0.2.7 lib/bitcoin/message/tx.rb
bitcoinrb-0.2.6 lib/bitcoin/message/tx.rb
bitcoinrb-0.2.5 lib/bitcoin/message/tx.rb
bitcoinrb-0.2.4 lib/bitcoin/message/tx.rb
bitcoinrb-0.2.2 lib/bitcoin/message/tx.rb
bitcoinrb-0.2.1 lib/bitcoin/message/tx.rb
bitcoinrb-0.2.0 lib/bitcoin/message/tx.rb
bitcoinrb-0.1.9 lib/bitcoin/message/tx.rb
bitcoinrb-0.1.8 lib/bitcoin/message/tx.rb
bitcoinrb-0.1.7 lib/bitcoin/message/tx.rb
bitcoinrb-0.1.6 lib/bitcoin/message/tx.rb