bitcoinrb 0.2.7 → 0.2.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/lib/bitcoin/ext_key.rb +2 -2
- data/lib/bitcoin/key.rb +1 -1
- data/lib/bitcoin/merkle_tree.rb +10 -6
- data/lib/bitcoin/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab7cf06beb0cf2d36a34c86558f3432fe951416c493c70782e7b7e647bc4e7fb
|
4
|
+
data.tar.gz: a5e13cb5b79a0fd15f008405c5973326158d18d581fbc899f6bd6f9ded5b810a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5acbb1325f300e0e726f09447cb3f7806a2ff82e5f8f0bbef3c3879540b83e350f48ae33d424cec86f5bc5062a5ef64120c8f8aa4278cfeb173cbec57d96078
|
7
|
+
data.tar.gz: ff5031d47259afb685e87ebfcb681efd6e041759943b5ce8753d69bd26763e87296ae3acadfa3eeee15e3e0ca20495f41e129e8c5ad6058017184c0460608df2
|
data/lib/bitcoin/ext_key.rb
CHANGED
@@ -126,7 +126,7 @@ module Bitcoin
|
|
126
126
|
v = version
|
127
127
|
case v
|
128
128
|
when Bitcoin.chain_params.bip49_privkey_p2wpkh_p2sh_version
|
129
|
-
Bitcoin::Key::TYPES[:
|
129
|
+
Bitcoin::Key::TYPES[:p2wpkh_p2sh]
|
130
130
|
when Bitcoin.chain_params.bip84_privkey_p2wpkh_version
|
131
131
|
Bitcoin::Key::TYPES[:p2wpkh]
|
132
132
|
when Bitcoin.chain_params.extended_privkey_version
|
@@ -280,7 +280,7 @@ module Bitcoin
|
|
280
280
|
v = version
|
281
281
|
case v
|
282
282
|
when Bitcoin.chain_params.bip49_pubkey_p2wpkh_p2sh_version
|
283
|
-
Bitcoin::Key::TYPES[:
|
283
|
+
Bitcoin::Key::TYPES[:p2wpkh_p2sh]
|
284
284
|
when Bitcoin.chain_params.bip84_pubkey_p2wpkh_version
|
285
285
|
Bitcoin::Key::TYPES[:p2wpkh]
|
286
286
|
when Bitcoin.chain_params.extended_pubkey_version
|
data/lib/bitcoin/key.rb
CHANGED
@@ -16,7 +16,7 @@ module Bitcoin
|
|
16
16
|
attr_accessor :key_type
|
17
17
|
attr_reader :secp256k1_module
|
18
18
|
|
19
|
-
TYPES = {uncompressed: 0x00, compressed: 0x01, p2pkh: 0x10, p2wpkh: 0x11,
|
19
|
+
TYPES = {uncompressed: 0x00, compressed: 0x01, p2pkh: 0x10, p2wpkh: 0x11, p2wpkh_p2sh: 0x12}
|
20
20
|
|
21
21
|
MIN_PRIV_KEY_MOD_ORDER = 0x01
|
22
22
|
# Order of secp256k1's generator minus 1.
|
data/lib/bitcoin/merkle_tree.rb
CHANGED
@@ -14,11 +14,15 @@ module Bitcoin
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.build_from_leaf(txids)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
if txids.size == 1
|
18
|
+
nodes = [Node.new(txids.first)]
|
19
|
+
else
|
20
|
+
nodes = txids.each_slice(2).map{ |m|
|
21
|
+
left = Node.new(m[0])
|
22
|
+
right = Node.new(m[1] ? m[1] : m[0])
|
23
|
+
[left, right]
|
24
|
+
}.flatten
|
25
|
+
end
|
22
26
|
new(build_initial_tree(nodes))
|
23
27
|
end
|
24
28
|
|
@@ -103,7 +107,7 @@ module Bitcoin
|
|
103
107
|
end
|
104
108
|
|
105
109
|
def next_partial
|
106
|
-
return nil if root? && (flag.zero? || (left.partial? && right.partial?))
|
110
|
+
return nil if root? && (flag.zero? || (left.nil? && right.nil?) || (left.partial? && right.partial?))
|
107
111
|
return parent.next_partial if flag.zero? || leaf?
|
108
112
|
return left unless left.partial?
|
109
113
|
self.right = left.dup unless right
|
data/lib/bitcoin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitcoinrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- azuchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ecdsa
|