Commit 6d329151daa22ce4c8d8ac1de58e4754eb6342cc

Authored by comboy
Committed by Julian Langschaedel
1 parent b57c7fd4df

let's not recalculate hashes for objects fetched from db

We have check consistency for that.
Comparison "blk.hash == blk.recalc_block_hash" in consistency check
would even suggest that blk.hash is expected to be fetched from the db

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

lib/bitcoin/storage/sequel/sequel_store.rb
... ... @@ -376,7 +376,7 @@
376 376  
377 377 blk.tx = blk_tx.map { |tx| wrap_tx(tx, block[:id], inputs: inputs[tx[:id]], outputs: outputs[tx[:id]]) }
378 378  
379   - blk.recalc_block_hash
  379 + blk.hash = block[:hash].hth
380 380 blk
381 381 end
382 382  
... ... @@ -397,7 +397,7 @@
397 397 outputs.each { |o| tx.add_out(wrap_txout(o)) }
398 398 tx.ver = transaction[:version]
399 399 tx.lock_time = transaction[:lock_time]
400   - tx.hash = tx.hash_from_payload(tx.to_payload)
  400 + tx.hash = transaction[:hash].hth
401 401 tx
402 402 end
403 403