xrbp 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d19910e3c88e5a509e3ed8e763bfd30ae764c6a7e31464b36e66ea7f03ce6929
4
- data.tar.gz: 8105339c1ba88f6cc9e52b18bb72a44434ff3646f4fa1f6cfdde2691654e2ed0
3
+ metadata.gz: '096cdf11861212228f99c1f93fca43c0ca503107bbd4602356e55991397a29a9'
4
+ data.tar.gz: b6178472d0dd06f47fb38632d5458ea7ffa86720a657e03e3e9c1cc640d2d4e6
5
5
  SHA512:
6
- metadata.gz: 439f2a90a8eb76f1e3ac28f6bb08fd0bbbdb7ec1c600df52199cc56db1738c1cbe2cfae45c484c5d1b1d7635c00db88d38428ffa98c77977c9e36252f9a7962a
7
- data.tar.gz: 9f87cdb439e262527cbec2181d86a21931fc44d29fb4a9900ad479ad385479921f06d2ba9a6cda245894de51b98607a21f39ed2d8921fe8b75dab2e1e2859546
6
+ metadata.gz: 67870bc15932d4b2877ac4fffd4bf07221c8ef4834f0a41f72bffa621f246239f5194922c1d9fbb4933d83054eb88c8bffef93f0b95a9940a1389cb74fab69fd
7
+ data.tar.gz: 1afd32b1bdf8b9b5be99337da2fc4fd91f29d6dbd8c5deb90a3bf14cbeb9d4a479177c26e4040edf3310b18b11d9d79e1d1532af2855eeefad5b50710211d44b
@@ -5,9 +5,10 @@ require 'xrbp/nodestore/backends/nudb'
5
5
  db = XRBP::NodeStore::Backends::NuDB.new "/var/lib/rippled/nudb/"
6
6
  store = db.instance_variable_get(:@store)
7
7
 
8
- key = [85, 128, 20, 72, 146, 231, 227, 37, 187, 39, 215, 214, 137, 172, 74, 102, 212, 160, 121, 146, 42, 165, 122, 58, 253, 41, 102, 206, 69, 144, 37, 66].pack("C*")
8
+ key = [47, 126, 65, 231, 47, 167, 3, 91, 161, 174, 133, 152, 2, 230, 171, 139, 209, 40, 100, 217, 100, 131, 160, 49, 186, 119, 31, 84, 75, 116, 125, 81].pack("C*")
9
9
  val = store.fetch(key).first
10
- puts val.unpack("C*").join " "
10
+ #puts val.unpack("C*").join " "
11
11
  decompressed = db.send(:decompress, val)
12
12
  puts decompressed.unpack("C*").join " "
13
13
  type, obj = db.send(:infer_type, decompressed)
14
+ puts obj
@@ -30,6 +30,7 @@ module XRBP
30
30
 
31
31
  RuDB::each(dat) do |key, val|
32
32
  val = decompress(val)
33
+ puts key.bytes.join(", ")
33
34
  type, obj = infer_type(val)
34
35
 
35
36
  if type
@@ -99,7 +99,7 @@ module XRBP
99
99
 
100
100
  def parse_fields(fields)
101
101
  parsed = {}
102
- until fields == "" || fields.nil?
102
+ until fields == "" || fields == "\0" || fields.nil?
103
103
  encoding, fields = parse_encoding(fields)
104
104
  return parsed if encoding.first.nil?
105
105
 
@@ -249,7 +249,7 @@ module XRBP
249
249
  end
250
250
 
251
251
  def parse_pathset(data)
252
- pathset = []
252
+ pathset = [[]]
253
253
  until data == "" || data.nil?
254
254
  segment = data.unpack("C").first
255
255
  data = data[1..-1]
@@ -258,18 +258,27 @@ module XRBP
258
258
  if segment == 0xFF # path boundry
259
259
  pathset << []
260
260
  else
261
+ account, current, issuer = nil
262
+
263
+ path = {}
264
+
261
265
  if (segment & 0x01) != 0 # path account
262
- issuer, data = parse_account(data, 20)
266
+ account, data = parse_account(data, 20)
267
+ path[:account] = account
263
268
  end
264
269
 
265
- if (segment & 0x02) != 0 # path currency
270
+ if (segment & 0x10) != 0 # path currency
266
271
  currency = Format::CURRENCY_CODE.decode(data)
267
272
  data = data[Format::CURRENCY_CODE.size..-1]
273
+ path[:currency] = currency
268
274
  end
269
275
 
270
- if (segment & 0x03) != 0 # path issuer
276
+ if (segment & 0x20) != 0 # path issuer
271
277
  issuer, data = parse_account(data, 20)
278
+ path[:issuer] = issuer
272
279
  end
280
+
281
+ pathset.last << path
273
282
  end
274
283
  end
275
284
 
@@ -1,3 +1,3 @@
1
1
  module XRBP
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end # module XRBP
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xrbp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dev Null Productions
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-16 00:00:00.000000000 Z
11
+ date: 2019-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json