onchain 2.1.1 → 2.1.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/onchain/transaction.rb +11 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e22f8353705d9cf0ae2c8809117b989b29196d37
4
- data.tar.gz: b4a4a4e5b8a14348c48100b1b243300ec267135d
3
+ metadata.gz: 068b59667873048f533710cb2e04cdaa7d1703c3
4
+ data.tar.gz: 2f45540cbc3505d031fedb3dfce06318d14869ce
5
5
  SHA512:
6
- metadata.gz: b5a0ee70ae399e72d2b6a4594329b4a9e57e9380ecdbf7db203c9d7ab81ea4ae0fd11c321e305d3c64404bead27e0dedb69a9c5039533d7042c179416683c06b
7
- data.tar.gz: 9e29cce99b2d3d63a5c982befaaa6d45f5562bd27e92b9c45cf64c154765a11550869f582b75eb216e0961982e3499699a61919b6d50904e3cd6557a8378c95f
6
+ metadata.gz: 66f5b3b0ca2bacf7e8169dcaf97d5c81a33348fb967a8cdb9eee57ab4ae2c9edba693d0029b40ae6bec29ef0990767f46e96568d073b42ef30271bc9fc316e35
7
+ data.tar.gz: ff7e08551f0e199a654b8de6dd80289a1b5a8550310a63f53f937369a26f970134283c7743eb84f91351a505e5ed39a89bc649b9f6bf39b5de16498722b74353
@@ -51,10 +51,15 @@ class OnChain::Transaction
51
51
  def get_public_keys_from_script(script)
52
52
 
53
53
  if script.is_pubkey?
54
- return [script.get_pubkey]
54
+ return [Bitcoin.hash160_to_address(script.get_pubkey)]
55
55
  end
56
56
 
57
- return script.get_multisig_pubkeys
57
+ pubs = []
58
+ script.get_multisig_pubkeys.each do |pub|
59
+ pub_hex = OnChain.bin_to_hex(pub)
60
+ pubs << Bitcoin.hash160_to_address(Bitcoin.hash160(pub_hex))
61
+ end
62
+ return pubs
58
63
  end
59
64
 
60
65
  def get_inputs_to_sign(tx)
@@ -70,7 +75,7 @@ class OnChain::Transaction
70
75
  if inputs_to_sign[index] == nil
71
76
  inputs_to_sign[index] = {}
72
77
  end
73
- inputs_to_sign[index][OnChain.bin_to_hex(key)] = {'hash' => OnChain::bin_to_hex(hash)}
78
+ inputs_to_sign[index][key] = {'hash' => OnChain::bin_to_hex(hash)}
74
79
  end
75
80
  end
76
81
  return inputs_to_sign
@@ -160,9 +165,10 @@ class OnChain::Transaction
160
165
  sigs = []
161
166
 
162
167
  rscript = Bitcoin::Script.new txin.script
163
- rscript.get_multisig_pubkeys.each do |key|
168
+
169
+ pub_keys = get_public_keys_from_script(rscript)
170
+ pub_keys.each do |hkey|
164
171
 
165
- hkey = OnChain.bin_to_hex(key)
166
172
  if sig_list[index][hkey] != nil and sig_list[index][hkey]['sig'] != nil
167
173
 
168
174
  # Add the signature to the list.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onchain
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Purton