btcruby 1.0.7 → 1.0.8
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 +4 -4
- data/RELEASE_NOTES.md +5 -0
- data/lib/btcruby/key.rb +7 -5
- data/lib/btcruby/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f08e8037db701b84d3bcaa4668d31ac412f1ffe
|
4
|
+
data.tar.gz: d79f69ebbb77f91742a118418b242a73503392dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a741067c8ee868612b0efc58c293c9da7e530629eb8f9f8e5204167132162fe31a8766f2a8d35a26b7c19bf4745d24d17a8eda7350866eaafc81f726a5e3a42
|
7
|
+
data.tar.gz: fdeec25673942c8ded43a90fe9967c0ac6dc52e2b7d69e1943a6eb2c72a7daf1ac9f15bb99b68d1c95d6cb3a5fb085195762cfa0c65c5f67732c59dcc518cdf6
|
data/RELEASE_NOTES.md
CHANGED
data/lib/btcruby/key.rb
CHANGED
@@ -248,7 +248,7 @@ module BTC
|
|
248
248
|
# Checks if this signature with appended script hash type is well-formed.
|
249
249
|
# Logs detailed info using Diagnostics and returns true or false.
|
250
250
|
# Set verify_lower_s:false when processing incoming blocks.
|
251
|
-
def self.validate_script_signature(data, verify_lower_s: true)
|
251
|
+
def self.validate_script_signature(data, verify_lower_s: true, verify_hashtype: true)
|
252
252
|
# See https://bitcointalk.org/index.php?topic=8392.msg127623#msg127623
|
253
253
|
# A canonical signature exists of: <30> <total len> <02> <len R> <R> <02> <len S> <S> <hashtype>
|
254
254
|
# Where R and S are not negative (their first byte has its highest bit not set), and not
|
@@ -275,11 +275,13 @@ module BTC
|
|
275
275
|
|
276
276
|
bytes = data.bytes
|
277
277
|
|
278
|
-
|
278
|
+
if verify_hashtype
|
279
|
+
hashtype = bytes[length - 1] & (~(SIGHASH_ANYONECANPAY))
|
279
280
|
|
280
|
-
|
281
|
-
|
282
|
-
|
281
|
+
if hashtype < SIGHASH_ALL || hashtype > SIGHASH_SINGLE
|
282
|
+
Diagnostics.current.add_message("Non-canonical signature: unknown hashtype byte.")
|
283
|
+
return false
|
284
|
+
end
|
283
285
|
end
|
284
286
|
|
285
287
|
if bytes[0] != 0x30
|
data/lib/btcruby/version.rb
CHANGED