public async Task MakeSureTwoRunningRoundsAsync(Money feePerInputs = null, Money feePerOutputs = null) { using (await RoundsListLock.LockAsync().ConfigureAwait(false)) { int runningRoundCount = Rounds.Count(x => x.Status == CoordinatorRoundStatus.Running); int confirmationTarget = await AdjustConfirmationTargetAsync(lockCoinJoins : true).ConfigureAwait(false); if (runningRoundCount == 0) { var round = new CoordinatorRound(RpcClient, UtxoReferee, RoundConfig, confirmationTarget, RoundConfig.ConfirmationTarget, RoundConfig.ConfirmationTargetReductionRate); round.CoinJoinBroadcasted += Round_CoinJoinBroadcasted; round.StatusChanged += Round_StatusChangedAsync; await round.ExecuteNextPhaseAsync(RoundPhase.InputRegistration, feePerInputs, feePerOutputs).ConfigureAwait(false); Rounds.Add(round); var round2 = new CoordinatorRound(RpcClient, UtxoReferee, RoundConfig, confirmationTarget, RoundConfig.ConfirmationTarget, RoundConfig.ConfirmationTargetReductionRate); round2.StatusChanged += Round_StatusChangedAsync; round2.CoinJoinBroadcasted += Round_CoinJoinBroadcasted; await round2.ExecuteNextPhaseAsync(RoundPhase.InputRegistration, feePerInputs, feePerOutputs).ConfigureAwait(false); Rounds.Add(round2); } else if (runningRoundCount == 1) { var round = new CoordinatorRound(RpcClient, UtxoReferee, RoundConfig, confirmationTarget, RoundConfig.ConfirmationTarget, RoundConfig.ConfirmationTargetReductionRate); round.StatusChanged += Round_StatusChangedAsync; round.CoinJoinBroadcasted += Round_CoinJoinBroadcasted; await round.ExecuteNextPhaseAsync(RoundPhase.InputRegistration, feePerInputs, feePerOutputs).ConfigureAwait(false); Rounds.Add(round); } } }
public async Task MakeSureTwoRunningRoundsAsync() { using (await RoundsListLock.LockAsync()) { int runningRoundCount = Rounds.Count(x => x.Status == CcjRoundStatus.Running); if (runningRoundCount == 0) { var round = new CcjRound(RpcClient, UtxoReferee, RoundConfig); round.StatusChanged += Round_StatusChangedAsync; await round.ExecuteNextPhaseAsync(CcjRoundPhase.InputRegistration); Rounds.Add(round); var round2 = new CcjRound(RpcClient, UtxoReferee, RoundConfig); round2.StatusChanged += Round_StatusChangedAsync; await round2.ExecuteNextPhaseAsync(CcjRoundPhase.InputRegistration); Rounds.Add(round2); } else if (runningRoundCount == 1) { var round = new CcjRound(RpcClient, UtxoReferee, RoundConfig); round.StatusChanged += Round_StatusChangedAsync; await round.ExecuteNextPhaseAsync(CcjRoundPhase.InputRegistration); Rounds.Add(round); } } }