Class: Lightning::Onion::PerHop
- Inherits:
-
Object
- Object
- Lightning::Onion::PerHop
- Defined in:
- lib/lightning/onion/per_hop.rb
Constant Summary collapse
- LAST_NODE =
PerHop.parse("\x00" * 32)
Instance Attribute Summary collapse
-
#amt_to_forward ⇒ Object
Returns the value of attribute amt_to_forward.
-
#outgoing_cltv_value ⇒ Object
Returns the value of attribute outgoing_cltv_value.
-
#padding ⇒ Object
Returns the value of attribute padding.
-
#short_channel_id ⇒ Object
Returns the value of attribute short_channel_id.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(short_channel_id, amt_to_forward, outgoing_cltv_value, padding) ⇒ PerHop
constructor
A new instance of PerHop.
- #to_payload ⇒ Object
Constructor Details
#initialize(short_channel_id, amt_to_forward, outgoing_cltv_value, padding) ⇒ PerHop
Returns a new instance of PerHop.
7 8 9 10 11 12 |
# 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 |
Instance Attribute Details
#amt_to_forward ⇒ Object
Returns the value of attribute amt_to_forward.
6 7 8 |
# File 'lib/lightning/onion/per_hop.rb', line 6 def amt_to_forward @amt_to_forward end |
#outgoing_cltv_value ⇒ Object
Returns the value of attribute outgoing_cltv_value.
6 7 8 |
# File 'lib/lightning/onion/per_hop.rb', line 6 def outgoing_cltv_value @outgoing_cltv_value end |
#padding ⇒ Object
Returns the value of attribute padding.
6 7 8 |
# File 'lib/lightning/onion/per_hop.rb', line 6 def padding @padding end |
#short_channel_id ⇒ Object
Returns the value of attribute short_channel_id.
6 7 8 |
# File 'lib/lightning/onion/per_hop.rb', line 6 def short_channel_id @short_channel_id end |
Class Method Details
.parse(payload) ⇒ Object
14 15 16 |
# File 'lib/lightning/onion/per_hop.rb', line 14 def self.parse(payload) new(*payload.unpack('Q>2Na12')) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
23 24 25 |
# File 'lib/lightning/onion/per_hop.rb', line 23 def ==(other) other.class == self.class && other.to_a == to_a end |
#hash ⇒ Object
29 30 31 |
# File 'lib/lightning/onion/per_hop.rb', line 29 def hash to_a.hash end |
#to_payload ⇒ Object
19 20 21 |
# File 'lib/lightning/onion/per_hop.rb', line 19 def to_payload to_a.pack('Q>2Na12') end |