Skip to content

Commit

Permalink
Change to set an empty Bitcoin::Script if the length of scriptSig is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
azuchi committed Jul 2, 2020
1 parent 8f1b36d commit ad77506
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/bitcoin/tx_in.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ def self.parse_from_payload(payload)
hash, index = buf.read(36).unpack('a32V')
i.out_point = OutPoint.new(hash.bth, index)
sig_length = Bitcoin.unpack_var_int_from_io(buf)
sig = buf.read(sig_length)
if i.coinbase?
i.script_sig.chunks[0] = sig
if sig_length == 0
i.script_sig = Bitcoin::Script.new
else
i.script_sig = Script.parse_from_payload(sig)
i.script_sig = Script.parse_from_payload(buf.read(sig_length))
end
i.sequence = buf.read(4).unpack('V').first
i
Expand Down

0 comments on commit ad77506

Please # to comment.