lib/bitcoin/protocol/tx.rb in bitcoin-ruby-0.0.8 vs lib/bitcoin/protocol/tx.rb in bitcoin-ruby-0.0.9

- old
+ new

@@ -259,10 +259,10 @@ ins = h['in'] || h['inputs'] outs = h['out'] || h['outputs'] ins .each{|input| tx.add_in TxIn.from_hash(input) } outs.each{|output| tx.add_out TxOut.from_hash(output) } tx.instance_eval{ @hash = hash_from_payload(@payload = to_payload) } - unless h['hash'] == tx.hash + if h['hash'] && (h['hash'] != tx.hash) raise "Tx hash mismatch! Claimed: #{h['hash']}, Actual: #{tx.hash}" if do_raise end tx end