Sha256: cef18514254bc89b2d672df71d141d3883a4d0588fc8857311dcc813288a7c2e

Contents?: true

Size: 660 Bytes

Versions: 3

Compression:

Stored size: 660 Bytes

Contents

# frozen_string_literal: true

module Lightning
  module Onion
    class PerHop
      attr_accessor :channel_id, :amt_to_forward, :outgoing_cltv_value, :padding
      def initialize(channel_id, amt_to_forward, outgoing_cltv_value, padding)
        @channel_id = channel_id
        @amt_to_forward = amt_to_forward
        @outgoing_cltv_value = outgoing_cltv_value
        @padding = padding
      end

      def self.parse(payload)
        new(*payload.unpack('a8N2a16'))
      end

      def to_payload
        [channel_id, amt_to_forward, outgoing_cltv_value, padding].pack('a8N2a16')
      end
      LAST_NODE = PerHop.parse("\x00" * 32)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lightning-onion-0.2.1 lib/lightning/onion/per_hop.rb
lightning-onion-0.2.0 lib/lightning/onion/per_hop.rb
lightning-onion-0.1.0 lib/lightning/onion/per_hop.rb