private async Task <(List <Deposit>, List <WithdrawInfo>)> LoadOps(string blockNumberDeposits) { await client.WaitServerStartedAsync(); session = await client.CreateWebsocketNotificationSessionAsync(); session.ListenTrackedSources(new[] { oracleAddress }); ProcessNotifications(); var oldTx = (await client.GetTransactionsAsync(oracleAddress)).ConfirmedTransactions.Transactions; int heigth = 0; if (!string.IsNullOrEmpty(blockNumberDeposits)) { heigth = int.Parse(blockNumberDeposits); } if (heigth > 0) { oldTx = oldTx.Where(t => t.Height > heigth).ToList(); return(ProcessOperations(oldTx)); } else { return(ProcessOperations(oldTx)); } }
public async Task <GetTransactionsResponse> FetchTransactions(DerivationStrategyBase derivationStrategyBase) { return(FilterValidTransactions(await _Client.GetTransactionsAsync(derivationStrategyBase))); }
public Task <GetTransactionsResponse> FetchTransactions(DerivationStrategyBase derivationStrategyBase) { return(_Client.GetTransactionsAsync(derivationStrategyBase)); }
private async Task <(List <Deposit>, List <WithdrawInfo>)> LoadOps(string blockNumberDeposits) { var listenerStarted = false; while (!listenerStarted) { try { await client.WaitServerStartedAsync(); session = await client.CreateWebsocketNotificationSessionAsync(); session.ListenTrackedSources(new[] { oracleAddress }); ProcessNotifications(); listenerStarted = true; } catch (Exception e) { Log.Error("Failed to stablish bitcoin websocket connector "); Log.Error(e.ToString()); await Task.Delay(3000); } } var opLoaded = false; while (!opLoaded) { try { var oldTx = (await client.GetTransactionsAsync(oracleAddress)).ConfirmedTransactions.Transactions; opLoaded = true; int heigth = 0; if (!string.IsNullOrEmpty(blockNumberDeposits)) { heigth = int.Parse(blockNumberDeposits); } if (heigth > 0) { oldTx = oldTx.Where(t => t.Height > heigth).ToList(); return(ProcessOperations(oldTx)); } else { return(ProcessOperations(oldTx)); } } catch (Exception e) { Log.Error("Failed to load transactions"); Log.Error(e.ToString()); if (opLoaded) { throw; } await Task.Delay(3000); } } return(new List <Deposit>(), new List <WithdrawInfo>()); }