Commit b57c7fd4df26c243722a062f8933044eec3ffe17

Authored by comboy
Committed by Julian Langschaedel
1 parent 5d38bc911e

cache tx binary hash

This gets called *a lot*. To my surprise there is actually measurable
improvement in block store time with this.

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

lib/bitcoin/protocol/tx.rb
... ... @@ -35,7 +35,7 @@
35 35  
36 36 # return the tx hash in binary format
37 37 def binary_hash
38   - [@hash].pack("H*").reverse
  38 + @binary_hash ||= [@hash].pack("H*").reverse
39 39 end
40 40  
41 41 # create tx from raw binary +data+