예제 #1
0
 public async Task <IEnumerable <uint256> > GetUnconfirmedCoinJoinsAsync()
 {
     using (await CoinJoinsLock.LockAsync())
     {
         return(UnconfirmedCoinJoins.ToArray());
     }
 }
예제 #2
0
        public async Task <bool> IsUnconfirmedCoinJoinLimitReachedAsync()
        {
            using (await CoinJoinsLock.LockAsync())
            {
                if (UnconfirmedCoinJoins.Count < 24)
                {
                    return(false);
                }
                foreach (var cjHash in UnconfirmedCoinJoins.ToArray())
                {
                    try
                    {
                        var txInfo = await RpcClient.GetRawTransactionInfoAsync(cjHash);

                        // if confirmed remove only from unconfirmed
                        if (txInfo.Confirmations > 0)
                        {
                            UnconfirmedCoinJoins.Remove(cjHash);
                        }
                    }
                    catch (Exception ex)
                    {
                        // If aborted remove from everywhere (should not happen normally).
                        UnconfirmedCoinJoins.Remove(cjHash);
                        CoinJoins.Remove(cjHash);
                        await File.WriteAllLinesAsync(CoinJoinsFilePath, CoinJoins.Select(x => x.ToString()));

                        Logger.LogWarning <CcjCoordinator>(ex);
                    }
                }

                return(UnconfirmedCoinJoins.Count >= 24);
            }
        }