Sha256: 27dc52353eee7836a4e394a94824408e0213ee4281a0873e17375aa8d746d673

Contents?: true

Size: 690 Bytes

Versions: 1

Compression:

Stored size: 690 Bytes

Contents

# frozen_string_literal: true

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

      def self.parse(payload)
        new(*payload.unpack('Q>2Na16'))
      end

      def to_payload
        [short_channel_id, amt_to_forward, outgoing_cltv_value, padding].pack('Q>2Na12')
      end
      LAST_NODE = PerHop.parse("\x00" * 32)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lightning-onion-0.2.2 lib/lightning/onion/per_hop.rb