예제 #1
0
 public ScanUTXOSetService(ScanUTXOSetServiceAccessor accessor,
                           RPCClientProvider rpcClients,
                           KeyPathTemplates keyPathTemplates,
                           RepositoryProvider repositories)
 {
     accessor.Instance     = this;
     RpcClients            = rpcClients;
     this.keyPathTemplates = keyPathTemplates;
     Repositories          = repositories;
 }
예제 #2
0
        public RepositoryProvider(NBXplorerNetworkProvider networks, KeyPathTemplates keyPathTemplates, ExplorerConfiguration configuration)
        {
            this.keyPathTemplates = keyPathTemplates;
            _Configuration        = configuration;
            var directory = Path.Combine(configuration.DataDir, "db");

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            int tried = 0;

retry:
            try
            {
                _Engine = new DBriizeEngine(new DBriizeConfiguration()
                {
                    DBriizeDataFolderName = directory
                });
            }
            catch when(tried < 10)
            {
                tried++;
                Thread.Sleep(tried * 500);
                goto retry;
            }
            foreach (var net in networks.GetAll())
            {
                var settings = GetChainSetting(net);
                if (settings != null)
                {
                    var repo = net.NBitcoinNetwork.NetworkSet == Liquid.Instance ? new LiquidRepository(_Engine, net, keyPathTemplates, settings.RPC) : new Repository(_Engine, net, keyPathTemplates, settings.RPC);
                    repo.MaxPoolSize  = configuration.MaxGapSize;
                    repo.MinPoolSize  = configuration.MinGapSize;
                    repo.MinUtxoValue = settings.MinUtxoValue;
                    _Repositories.Add(net.CryptoCode, repo);
                }
            }
        }
예제 #3
0
 internal LiquidRepository(DBTrie.DBTrieEngine engine, NBXplorerNetwork network, KeyPathTemplates keyPathTemplates,
                           RPCClient rpcClient) : base(engine, network, keyPathTemplates, rpcClient)
 {
     _rpcClient = rpcClient;
 }
예제 #4
0
 public AddressPoolService(NBXplorerNetworkProvider networks, RepositoryProvider repositoryProvider, KeyPathTemplates keyPathTemplates, AddressPoolServiceAccessor accessor)
 {
     accessor.Instance     = this;
     _AddressPoolByNetwork = networks.GetAll().ToDictionary(o => o, o => new AddressPool(repositoryProvider.GetRepository(o)));
     this.keyPathTemplates = keyPathTemplates;
 }
예제 #5
0
 public AddressPoolService(NBXplorerNetworkProvider networks, RepositoryProvider repositoryProvider, KeyPathTemplates keyPathTemplates)
 {
     this.networks           = networks;
     this.repositoryProvider = repositoryProvider;
     this.keyPathTemplates   = keyPathTemplates;
 }