lightning-onion 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f532c0ead98e2302135ebe51d2546a63bd1d46bd
4
- data.tar.gz: cb6692857777b2ba41818a49f4c8ddc3e6fa1f51
3
+ metadata.gz: 2c6806de17849e69c6989e9ee721d72f5b65970c
4
+ data.tar.gz: cda740daf5f7ed956b53c0c9dce39469ac717b71
5
5
  SHA512:
6
- metadata.gz: '07209896697cdfe318e2f24284398944de874a273522f482d13d0ff4669b9db756434fce262d1410d7c5b70ab86b19ec94fcfd19d6e6c47130a7da8815be266d'
7
- data.tar.gz: 3fa984539c52051aab37367a4a5f22ec3768ff578afe832fc3202526f3fc6e47ae12654d2e32b8ac0dcd8fea9880f5890329e1e265ec0f793004cbbe9d79d868
6
+ metadata.gz: fe55f5943e8f57bb3a14119978ea98ff1dcc377e4fc94ea2d8bcd4faa5660fae1b26b0a7044e8a2c2e61bdc45000e469a1c27593d772f1b00838b417cc7ae169
7
+ data.tar.gz: 3e0e1834d0f26fef6b0e8403e2d3627c2aef2e57b98aaad74db73b3de8acc00b98f12c2d7f5c50324818acb1c83978717a2379d36a10c8c88295ac1a393d14b7
@@ -3,22 +3,24 @@
3
3
  module Lightning
4
4
  module Onion
5
5
  class Packet
6
- include Lightning::Onion::Sphinx
7
-
8
6
  attr_accessor :version, :public_key, :routing_info, :hmac
9
7
 
10
8
  def initialize(version, public_key, routing_info, hmac)
11
9
  @version = version
12
10
  @public_key = public_key
13
11
  @routing_info = routing_info
14
- raise "invalid size #{routing_info.size}" unless routing_info.size == MAX_HOPS * HOP_LENGTH * 2
12
+ raise "invalid size #{routing_info.size}" unless routing_info.size == Packet.routing_bytesize * 2
15
13
  @hmac = hmac
16
14
  end
17
15
 
16
+ def self.routing_bytesize
17
+ Lightning::Onion::Sphinx::MAX_HOPS * Lightning::Onion::Sphinx::HOP_LENGTH
18
+ end
19
+
18
20
  def self.parse(payload)
19
21
  version, public_key, rest = payload.unpack('aH66a*')
20
- routing_info = rest[0...MAX_HOPS * HOP_LENGTH].bth
21
- hmac = rest[MAX_HOPS * HOP_LENGTH..-1].bth
22
+ routing_info = rest[0...routing_bytesize].bth
23
+ hmac = rest[routing_bytesize..-1].bth
22
24
  new(version, public_key, routing_info, hmac)
23
25
  end
24
26
 
@@ -31,7 +33,7 @@ module Lightning
31
33
  end
32
34
 
33
35
  def last?
34
- hmac == "\x00" * 32
36
+ hmac == '00' * 32
35
37
  end
36
38
  end
37
39
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lightning
4
4
  module Onion
5
- VERSION = '0.2.5'
5
+ VERSION = '0.2.6'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lightning-onion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hajime Yamaguchi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-27 00:00:00.000000000 Z
11
+ date: 2018-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: algebrick