openassets-ruby 0.5.0 → 0.5.1

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
  SHA1:
3
- metadata.gz: b72bda7683e85f0fab9de4bb661bf18126246157
4
- data.tar.gz: d212bd8bcd3b784bd280c4f0f21c73a5e285113c
3
+ metadata.gz: bd0918ad4bb75cb8cbc1a3cd13fcedffde7d97a9
4
+ data.tar.gz: ca7fc189f43ea44adf304ab3a2f3e4df831a936f
5
5
  SHA512:
6
- metadata.gz: d8bde1f5913c9a701e57b48050cdf1ad2953c706daa66c186326ca7aaccb939a6504607c4e0946efef3eb7c7749e8af14d2d560743e867995b32c4cc6bec21ea
7
- data.tar.gz: 72ed9e77591d9af4cfc8774580c1d866908fb1204e64e21b9a3b55f0e01ede935cf95181bb30ec9ec0b9830dbaf8c87a1914b4a5951db9e28862d2085065994a
6
+ metadata.gz: 927f9c392e633ff2ce0f621b792283c5c6e3705dd9e8d83a561a4b946e0b575ec342e4512e72ceb8de1726963de72817ef924e5b481913e983cfdb0862578e5f
7
+ data.tar.gz: 0662166b353f3e54a6514d49440ff4c2fbaf82ee61d899e46107f4f3f325f6ae3ad10d7b8ae242e2e02f268cfbe0809bcff5dcb5737bd35cf66ec27dcc83816c
@@ -73,8 +73,6 @@ module OpenAssets
73
73
  # check metadata
74
74
  length, offset = read_var_integer(data, offset)
75
75
  return nil unless length
76
- puts [data].pack('H*').bytes.length
77
- puts length + offset
78
76
  return nil if [data].pack('H*').bytes.length < length + offset
79
77
  data
80
78
  end
@@ -127,7 +127,9 @@ module OpenAssets
127
127
  # https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer
128
128
  def read_var_integer(data, offset = 0)
129
129
  raise ArgumentError, "data is nil." unless data
130
- bytes = [data].pack('H*').bytes[offset..(offset + 9)] # 9 is variable integer max storage length.
130
+ packed = [data].pack('H*')
131
+ return [nil, 0] if packed.bytesize < 1+offset
132
+ bytes = packed.bytes[offset..(offset + 9)] # 9 is variable integer max storage length.
131
133
  first_byte = bytes[0]
132
134
  if first_byte < 0xfd
133
135
  [first_byte, offset + 1]
@@ -1,3 +1,3 @@
1
1
  module OpenAssets
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openassets-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - azuchi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-21 00:00:00.000000000 Z
11
+ date: 2016-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bitcoin-ruby