public LedgerTests() { _testScheduler = new TestScheduler(); _fakeRepository = Substitute.For <IAccountRepository>(); _hashProvider = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("keccak-256")); _mapperProvider = new TestMapperProvider(); _logger = Substitute.For <ILogger>(); _mempool = Substitute.For <IMempool <PublicEntryDao> >(); _deltaHashProvider = Substitute.For <IDeltaHashProvider>(); _receipts = Substitute.For <ITransactionRepository>(); _synchroniser = Substitute.For <ISynchroniser>(); _genesisHash = _hashProvider.ComputeUtf8MultiHash("genesis").ToCid(); _synchroniser.DeltaCache.GenesisHash.Returns(_genesisHash); _executor = Substitute.For <IDeltaExecutor>(); _stateProvider = Substitute.For <IStateProvider>(); _storageProvider = Substitute.For <IStorageProvider>(); _cryptoContext = new FfiWrapper(); _signingContext = new SigningContext { NetworkType = NetworkType.Devnet, SignatureType = SignatureType.TransactionPublic }; _deltaIndexService = new DeltaIndexService(new InMemoryRepository <DeltaIndexDao, string>()); }
private Dictionary <int, int> transactionsMap; // key - old TransactionId, value - new TransactionId public SyncService(ITransactionRepository transactionRepository, IAccountMobileRepository accountRepository, ICurrencyRepository currencyRepository, ICategoryRepository categoryRepository, IAccountGroupRepository accountGroupRepository, IUserRepository userRepository, ISynchronizationRepository synchronizationRepository, ITagRepository tagRepository, IUserIdentityContext userIdentityContext, GeneralSettings settings, ISyncRequestBuilder syncRequestBuilder, ISynchroniser synchroniser) { this.transactionRepository = transactionRepository; this.accountRepository = accountRepository; this.currencyRepository = currencyRepository; this.categoryRepository = categoryRepository; this.accountGroupRepository = accountGroupRepository; this.userRepository = userRepository; this.synchronizationRepository = synchronizationRepository; this.userIdentityContext = userIdentityContext; this.settings = settings; this.syncRequestBuilder = syncRequestBuilder; this.synchroniser = synchroniser; this.tagRepository = tagRepository; }
public CatalystNodePoa(IKeySigner keySigner, IPeerService peer, IConsensus consensus, IDfsService dfsService, ILedger ledger, ILogger logger, IPeerClient peerClient, IPeerSettings peerSettings, IMempool <PublicEntryDao> memPool, ISynchroniser synchronizer, IPeerRepository peerRepository, IContract contract = null) { Guard.Argument(peerRepository, nameof(peerRepository)).NotNull(); _peer = peer; _peerClient = peerClient; _peerSettings = peerSettings; Consensus = consensus; _dfsService = dfsService; _ledger = ledger; _keySigner = keySigner; _logger = logger; _memPool = memPool; _contract = contract; _synchronizer = synchronizer; _peerRepository = peerRepository; var privateKey = keySigner.KeyStore.KeyStoreDecrypt(KeyRegistryTypes.DefaultKey); _publicKey = keySigner.CryptoContext.GetPublicKeyFromPrivateKey(privateKey); }
public Ledger(IDeltaExecutor deltaExecutor, IStateProvider stateProvider, IStorageProvider storageProvider, ISnapshotableDb stateDb, IDb codeDb, IAccountRepository accounts, IDeltaIndexService deltaIndexService, ITransactionRepository receipts, IDeltaHashProvider deltaHashProvider, ISynchroniser synchroniser, IMempool <PublicEntryDao> mempool, IMapperProvider mapperProvider, IHashProvider hashProvider, ILogger logger) { Accounts = accounts; _deltaExecutor = deltaExecutor; _stateProvider = stateProvider; _storageProvider = storageProvider; _stateDb = stateDb; _codeDb = codeDb; _mempool = mempool; _mapperProvider = mapperProvider; _hashProvider = hashProvider; _logger = logger; _receipts = receipts; _synchroniser = synchroniser; _deltaUpdatesSubscription = deltaHashProvider.DeltaHashUpdates.Subscribe(Update); _deltaIndexService = deltaIndexService; var latestDeltaIndex = _deltaIndexService.LatestDeltaIndex(); if (latestDeltaIndex != null) { _latestKnownDelta = latestDeltaIndex.Cid; _latestKnownDeltaNumber = (long)latestDeltaIndex.Height; return; } _latestKnownDelta = _synchroniser.DeltaCache.GenesisHash; WriteLatestKnownDelta(_latestKnownDelta); }
public SyncMobileService(IFileHelper fileHelper, ISyncService syncService, ITransactionRepository transactionRepository, ISyncRequestBuilder syncRequestBuilder, ISynchroniser synchroniser, ISynchronizationRepository synchronizationRepository, ILogger logger, GeneralSettings settings ) { this.fileHelper = fileHelper; this.syncService = syncService; this.transactionRepository = transactionRepository; this.syncRequestBuilder = syncRequestBuilder; this.synchroniser = synchroniser; this.synchronizationRepository = synchronizationRepository; this.httpClient = App.Container.ResolveNamed <HttpClient>("api"); this.settings = settings; this.logger = logger; }
/// <summary> /// Equality check. /// Used in test. /// </summary> /// <param name="other">Synchroniser to compare</param> /// <returns>True or false if "other" has same peroperties</returns> private bool Equals(ISynchroniser other) { return(Equals(Data, other.Data)); }
public void RemoveSynchroniser(ISynchroniser synchroniser) { m_Synchronisers.Remove(synchroniser); }
public void AddSynchroniser(ISynchroniser synchroniser) { m_Synchronisers.Add(synchroniser); }