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
-
#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
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>2Na16')) end |
Instance Method Details
#to_payload ⇒ Object
18 19 20 |
# File 'lib/lightning/onion/per_hop.rb', line 18 def to_payload [short_channel_id, amt_to_forward, outgoing_cltv_value, padding].pack('Q>2Na12') end |