LCOV - code coverage report
Current view: top level - crypto/utxo/utils - utxo_in_memory_cache.dart (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 11 11
Test Date: 2025-01-30 01:10:00 Functions: - 0 0

            Line data    Source code
       1              : import 'package:walletkit_dart/walletkit_dart.dart';
       2              : 
       3           24 : final Map<CoinEntity, UtxoInMemoryCache> _utxoCaches = {};
       4              : 
       5            8 : UtxoInMemoryCache getUtxoInMemoryCache(CoinEntity coin) {
       6           16 :   if (_utxoCaches[coin] == null) {
       7           24 :     _utxoCaches[coin] = UtxoInMemoryCache();
       8              :   }
       9           16 :   return _utxoCaches[coin]!;
      10              : }
      11              : 
      12              : class UtxoInMemoryCache {
      13              :   final Map<String, UTXOTransaction> _txCache = {};
      14              : 
      15            8 :   UTXOTransaction? getTx({required String txHash}) {
      16           24 :     return _txCache[txHash.toLowerCase()];
      17              :   }
      18              : 
      19            8 :   void insertTxIfConfirmed(UTXOTransaction tx) {
      20            8 :     if (tx.isPending) {
      21              :       return;
      22              :     }
      23           16 :     if (tx.confirmations <= 0) {
      24              :       return;
      25              :     }
      26           32 :     _txCache[tx.hash.toLowerCase()] = tx;
      27              :   }
      28              : }
        

Generated by: LCOV version 2.0-1