Class: Istox::BlockchainHashHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/istox/consumers/blockchain_hash_handler.rb

Class Method Summary collapse

Class Method Details

.hash_generated(data) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/istox/consumers/blockchain_hash_handler.rb', line 4

def hash_generated(data)
  puts "Locking #{data.uuid}"
  ::Istox::Lock.acquire(data.uuid) do
    receipt = ::Istox::BlockchainReceipt.where(txid: data.uuid, txhash: nil).first

    if receipt.nil?
      puts 'Transaction not found, skipping...'
      return
    end
    
    receipt.update!(txhash: data.txnHash)
  end
  puts "Releasing lock for #{data.uuid}"
end