Class: TxCatcher::Address
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- TxCatcher::Address
- Defined in:
- lib/txcatcher/models/address.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.find_or_catch_and_create(a) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/txcatcher/models/address.rb', line 10 def self.find_or_catch_and_create(a) # Even if there are not transactions to this address yet, we still create it, # because calling this method means someone is interested in this address and we need # to track it and maybe force catching it not just through mempool and ZeroMQ (see catcher.rb), # but also directly through querying RPC (slow, but at least we won't miss it). Address.find_or_create(address: a) if addr&.deposits.empty? && addr.created_at < (Time.now - 3600) # The address is in the DB, which means someone has been checking it, # but no deposits were associated with it and it's been more than 1 hour # since someone first got interested. Let's query the RPC directly, see if there were any transactions to this # address. end end |
Instance Method Details
#received_in_btc ⇒ Object
6 7 8 |
# File 'lib/txcatcher/models/address.rb', line 6 def received_in_btc CryptoUnit.new(Config["currency"], self.received, from_unit: :primary).to_standart end |