Commit ff61417ba30f3fe9b76ac482b0375fff02dd418e

Authored by comboy
Committed by Julian Langschaedel
1 parent 34d30ccd0a

more prev_txs cleanup

* for UtxoStore blk_id is always a block on the main chain
* for sequel store it stays the same as it was
* dummy only seems to care about the main chain
* for other storesi (to come) we assume blk_id will always be a block in the main
chain, which seems fair given Tx model only keeps association with one
block

Showing 1 changed file with 2 additions and 9 deletions Side-by-side Diff

lib/bitcoin/validation.rb
... ... @@ -325,15 +325,8 @@
325 325 def prev_txs
326 326 @prev_txs ||= tx.in.map {|i|
327 327 prev_tx = store.get_tx(i.prev_out.reverse_hth)
328   - next prev_tx if store.class.name =~ /UtxoStore/ && prev_tx
329   - next nil if !prev_tx && !@block
330   - if store.class.name =~ /SequelStore/
331   - next prev_tx if prev_tx && prev_tx.blk_id
332   - else
333   - next prev_tx if prev_tx && prev_tx.get_block && prev_tx.get_block.chain == 0
334   - end
335   - next nil if !@block
336   - @block.tx.find {|t| t.binary_hash == i.prev_out }
  328 + next prev_tx if prev_tx && prev_tx.blk_id # blk_id is set only if it's in the main chain
  329 + @block.tx.find {|t| t.binary_hash == i.prev_out } if @block
337 330 }.compact
338 331 end
339 332