btcruby 1.2.2 → 1.3

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: cefd4033ae3596836149bf235bb94b7f1b3d6963
4
- data.tar.gz: 74ebe0b3428d48d91bda78772ec5c84743ce6723
3
+ metadata.gz: 1ade4ab5ec4e048a83afbdf1d80da87d6cb78b65
4
+ data.tar.gz: df6796d9c48c3b71aad7916fec52a82bff17e09b
5
5
  SHA512:
6
- metadata.gz: c268750c6b2707040f17dee13781809a8bd3e7a36241ceaa5027fe7bc24bfef4e8eec4a13db209fa49c23575550ad6edbfe27ca01591cc2a7d4c08065286c38f
7
- data.tar.gz: 2c610aecba52ae7c9a5cf920e2aa6371b0950a1ee39afc95d9c78950a189273d2091c5c98f4cdadc74876b2178f83d5f0ab59a09e422f26ce7a501ef8a228bcf
6
+ metadata.gz: 115dcbaf2fdc9a208b317502767ece0935d5d186dca3ce8e59f666236b499f374044c307b800091f7eaf6e9759dd41daa68db7f06293b7e65de5a635f3558044
7
+ data.tar.gz: 795b12ce7b5d35aaa82b0c929facaf1532792f06cbe96727585649ec824009bea6f495a686f35f9626e1404d05b96026167bbe81ee6d3e0ae52bef9e677a0109
@@ -2,6 +2,13 @@
2
2
  BTCRuby Release Notes
3
3
  =====================
4
4
 
5
+ 1.3 (November 24, 2015)
6
+ -----------------------
7
+
8
+ * `BTC::Script#op_return_script?` now returns `true` for all scripts with first opcode `OP_RETURN`, including scripts with just that opcode or non-pushdata opcodes after it.
9
+ * `BTC::Script#op_return_data_only_script?` now returns `true` only if there is at least one pushdata chunk after `OP_RETURN` opcode and all subsequent opcodes are pushdata-only.
10
+
11
+
5
12
  1.2.2 (November 12, 2015)
6
13
  -----------------------
7
14
 
@@ -191,12 +191,18 @@ module BTC
191
191
  # Returns true if this script is a 'OP_RETURN <data>' script and
192
192
  # data size is within 40 bytes.
193
193
  def standard_op_return_script?
194
- retun false if !op_return_script? || @chunks.size != 2
194
+ retun false if !op_return_data_only_script? || @chunks.size != 2
195
195
  @chunks[1].pushdata.bytesize <= 40
196
196
  end
197
197
 
198
- # Returns true if this script is of form 'OP_RETURN <data>'
198
+ # Returns true if this script's first opcode is OP_RETURN.
199
199
  def op_return_script?
200
+ return @chunks.size >= 1 &&
201
+ @chunks[0].opcode == OP_RETURN
202
+ end
203
+
204
+ # Returns true if this script is of form 'OP_RETURN <data>'
205
+ def op_return_data_only_script?
200
206
  return @chunks.size >= 2 &&
201
207
  @chunks[0].opcode == OP_RETURN &&
202
208
  @chunks[1..-1].all?{|c| c.pushdata? }
@@ -205,14 +211,14 @@ module BTC
205
211
  # Returns first data chunk if this script is 'OP_RETURN <data>'.
206
212
  # Otherwise returns nil.
207
213
  def op_return_data
208
- return nil if !op_return_script?
214
+ return nil if !op_return_data_only_script?
209
215
  return @chunks[1].pushdata
210
216
  end
211
217
 
212
218
  # Returns all data chunks if this script is 'OP_RETURN <data> [<data>...]'
213
219
  # Most commonly returned array contains one binary string.
214
220
  def op_return_items
215
- return nil if !op_return_script?
221
+ return nil if !op_return_data_only_script?
216
222
  return @chunks[1, @chunks.size-1].map{|c| c.pushdata}
217
223
  end
218
224
 
@@ -220,7 +226,7 @@ module BTC
220
226
  # Only checks the prefix and minimal length, does not validate the content.
221
227
  # Use this method to quickly filter out non-asset transactions.
222
228
  def open_assets_marker?
223
- return false if !op_return_script?
229
+ return false if !op_return_data_only_script?
224
230
  data = op_return_data
225
231
  return false if !data || data.bytesize < 6
226
232
  if data[0, AssetMarker::PREFIX_V1.bytesize] == AssetMarker::PREFIX_V1
@@ -1,3 +1,3 @@
1
1
  module BTC
2
- VERSION = "1.2.2".freeze
2
+ VERSION = "1.3".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: btcruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: '1.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Andreev
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-12 00:00:00.000000000 Z
12
+ date: 2015-11-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi