bitcoinrb 0.2.7 → 0.2.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: 14d06b76233959dbd16e89459a109982612c8ec6e91b746328fac54bb0d6ddae
4
- data.tar.gz: ca60bd4fb4f1075335a0806bfdb5cd829da3f2a2d0b3794012e55ee17c7d417c
3
+ metadata.gz: ab7cf06beb0cf2d36a34c86558f3432fe951416c493c70782e7b7e647bc4e7fb
4
+ data.tar.gz: a5e13cb5b79a0fd15f008405c5973326158d18d581fbc899f6bd6f9ded5b810a
5
5
  SHA512:
6
- metadata.gz: d49893ec5f8819dc78c19974bd74e1cf2545a787e8861b212a2801e40135b3c0f22650e46df9d5089bbae47dd9c6b74ce13320763a4107633fce5a1355cbbc5b
7
- data.tar.gz: b2d422ecfc721e2e41b87d089dd2e6727f564f1346ae8a05b7e0d0b16247f8ca4b4113190c92d6e6abedb6180c8373289773ee6648963a10dbe9f3b0f726f471
6
+ metadata.gz: a5acbb1325f300e0e726f09447cb3f7806a2ff82e5f8f0bbef3c3879540b83e350f48ae33d424cec86f5bc5062a5ef64120c8f8aa4278cfeb173cbec57d96078
7
+ data.tar.gz: ff5031d47259afb685e87ebfcb681efd6e041759943b5ce8753d69bd26763e87296ae3acadfa3eeee15e3e0ca20495f41e129e8c5ad6058017184c0460608df2
@@ -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[:pw2pkh_p2sh]
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[:pw2pkh_p2sh]
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
@@ -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, pw2pkh_p2sh: 0x12}
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.
@@ -14,11 +14,15 @@ module Bitcoin
14
14
  end
15
15
 
16
16
  def self.build_from_leaf(txids)
17
- nodes = txids.each_slice(2).map{ |m|
18
- left = Node.new(m[0])
19
- right = Node.new(m[1] ? m[1] : m[0])
20
- [left, right]
21
- }.flatten
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
@@ -1,3 +1,3 @@
1
1
  module Bitcoin
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  end
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.7
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-05-01 00:00:00.000000000 Z
11
+ date: 2019-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ecdsa