onchain 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/onchain/transaction.rb +11 -5
- 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: 068b59667873048f533710cb2e04cdaa7d1703c3
|
4
|
+
data.tar.gz: 2f45540cbc3505d031fedb3dfce06318d14869ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66f5b3b0ca2bacf7e8169dcaf97d5c81a33348fb967a8cdb9eee57ab4ae2c9edba693d0029b40ae6bec29ef0990767f46e96568d073b42ef30271bc9fc316e35
|
7
|
+
data.tar.gz: ff7e08551f0e199a654b8de6dd80289a1b5a8550310a63f53f937369a26f970134283c7743eb84f91351a505e5ed39a89bc649b9f6bf39b5de16498722b74353
|
data/lib/onchain/transaction.rb
CHANGED
@@ -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
|
-
|
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][
|
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
|
-
|
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.
|