class Lightning::Onion::PerHop

Constants

LAST_NODE

Attributes

amt_to_forward[RW]
outgoing_cltv_value[RW]
padding[RW]
short_channel_id[RW]

Public Class Methods

new(short_channel_id, amt_to_forward, outgoing_cltv_value, padding) click to toggle source
# File lib/lightning/onion/per_hop.rb, line 7
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
parse(payload) click to toggle source
# File lib/lightning/onion/per_hop.rb, line 14
def self.parse(payload)
  new(*payload.unpack('Q>2Na12'))
end

Public Instance Methods

==(other) click to toggle source
# File lib/lightning/onion/per_hop.rb, line 23
def ==(other)
  other.class == self.class && other.to_a == to_a
end
Also aliased as: eql?
eql?(other)
Alias for: ==
hash() click to toggle source
# File lib/lightning/onion/per_hop.rb, line 29
def hash
  to_a.hash
end
to_payload() click to toggle source
# File lib/lightning/onion/per_hop.rb, line 19
def to_payload
  to_a.pack('Q>2Na12')
end

Protected Instance Methods

to_a() click to toggle source
# File lib/lightning/onion/per_hop.rb, line 35
def to_a
  [short_channel_id, amt_to_forward, outgoing_cltv_value, padding]
end