bitcoin-ruby 0.0.15 → 0.0.16

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: 392936a305872b186484815f8a1c6c91725029d1
4
- data.tar.gz: f44d55252bf1c614e5679b80113cfd59ca94815e
3
+ metadata.gz: 431060cb513326dbbed0e32a162c6f7e772acc9e
4
+ data.tar.gz: eeff2c6ad931e356c6df9665b42c99713e6030a8
5
5
  SHA512:
6
- metadata.gz: 2dab50ef851a4ba5a202099052ce566f86416cfdad002289668d76d109cdc32298fb0f3f99713522dee1d1dfa4bbac0335db3a9f4dd15b53bd7b9daaed9fc633
7
- data.tar.gz: 06b920e486a56d4c22ad20ac2da62f2d3c89da1a60f561c01e82bf7cf953bc8db9e70bed8de2e01b1517843c72132fe9cc68403624b897bbcbc2cf3845baee86
6
+ metadata.gz: 920eab4ecc29ff436633be245f53e46e72ccf4dd10256d3ae7363e6e7f7bd2e4b338e00502928d1299c48405a36d13a107c98a9db6032bed914cb25d1e42c51e
7
+ data.tar.gz: 878b83ec7fa9f97a58ece5fcccb69e9d68f4c3f75b479e5283e2a4185a2e44e588a413d324b18aec357f99eabf84590bbb25ee8713b1bcc0e2a193f80c7665c1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bitcoin-ruby (0.0.15)
4
+ bitcoin-ruby (0.0.16)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -99,10 +99,16 @@ module Bitcoin
99
99
 
100
100
  hex = decode_base58(address) rescue nil
101
101
  if hex && hex.bytesize == 50 && address_checksum?(address)
102
+ # Litecoin updates the P2SH version byte, and this method should recognize both.
103
+ p2sh_versions = [p2sh_version]
104
+ if Bitcoin.network[:legacy_p2sh_versions]
105
+ p2sh_versions += Bitcoin.network[:legacy_p2sh_versions]
106
+ end
107
+
102
108
  case hex[0...2]
103
109
  when address_version
104
110
  return :hash160
105
- when p2sh_version
111
+ when *p2sh_versions
106
112
  return :p2sh
107
113
  end
108
114
  end
@@ -727,6 +733,7 @@ module Bitcoin
727
733
  message_magic: "Litecoin Signed Message:\n",
728
734
  address_version: "30",
729
735
  p2sh_version: "32",
736
+ legacy_p2sh_versions: ["05"],
730
737
  privkey_version: "b0",
731
738
  bech32_hrp: "ltc",
732
739
  extended_privkey_version: "019d9cfe",
@@ -778,6 +785,7 @@ module Bitcoin
778
785
  magic_head: "\xfd\xd2\xc8\xf1",
779
786
  address_version: "6f",
780
787
  p2sh_version: "3a",
788
+ legacy_p2sh_versions: nil,
781
789
  privkey_version: "ef",
782
790
  bech32_hrp: "tltc",
783
791
  extended_privkey_version: "0436ef7d",
@@ -1,3 +1,3 @@
1
1
  module Bitcoin
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  end
@@ -192,6 +192,14 @@ describe 'Bitcoin Address/Hash160/PubKey' do
192
192
  Bitcoin.address_type("bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4").should == :witness_v0_keyhash
193
193
  Bitcoin.address_type("bc1qw508d6qejxtdg4y5r3zarvayr0c5xw7kv8f3t4").should == nil
194
194
  Bitcoin.address_type("bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv3").should == :witness_v0_scripthash
195
+
196
+ # address_type recognizes Litecoin addresses encoded with the legacy P2SH version byte
197
+ Bitcoin.network = :litecoin
198
+ Bitcoin.address_type("3CkxTG25waxsmd13FFgRChPuGYba3ar36B").should == :p2sh
199
+ Bitcoin.address_type("MJy6m9S3thpJa8GwM8fm2LeJbFC22w18Vx").should == :p2sh
200
+ Bitcoin.address_type("2MyLngQnhzjzatKsB7XfHYoP9e2XUXSiBMM").should == nil
201
+
202
+ Bitcoin.network = :bitcoin
195
203
  end
196
204
 
197
205
  it 'Bitcoin#checksum' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitcoin-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - lian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-26 00:00:00.000000000 Z
11
+ date: 2018-02-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This is a ruby library for interacting with the bitcoin protocol/network
14
14
  email: