public int RemoveAliceIfContains(OutPoint input) { var numberOfRemovedAlices = 0; using (RoundSyncronizerLock.Lock()) { if ((Phase != CcjRoundPhase.InputRegistration && Phase != CcjRoundPhase.ConnectionConfirmation) || Status != CcjRoundStatus.Running) { throw new InvalidOperationException("Removing Alice is only allowed in InputRegistration and ConnectionConfirmation phases."); } numberOfRemovedAlices = Alices.RemoveAll(x => x.Inputs.Any(y => y.OutPoint == input)); } Logger.LogInfo <CcjRound>($"Round ({RoundId}): {numberOfRemovedAlices} alices are removed."); return(numberOfRemovedAlices); }
public int RemoveAlicesBy(AliceState state) { int numberOfRemovedAlices = 0; using (RoundSyncronizerLock.Lock()) { if ((Phase != CcjRoundPhase.InputRegistration && Phase != CcjRoundPhase.ConnectionConfirmation) || Status != CcjRoundStatus.Running) { throw new InvalidOperationException("Removing Alice is only allowed in InputRegistration and ConnectionConfirmation phases."); } numberOfRemovedAlices = Alices.RemoveAll(x => x.State == state); } if (numberOfRemovedAlices != 0) { Logger.LogInfo <CcjRound>($"Round ({RoundId}): {numberOfRemovedAlices} alices in {state} state are removed."); } return(numberOfRemovedAlices); }
public int RemoveAlicesBy(params Guid[] ids) { var numberOfRemovedAlices = 0; using (RoundSyncronizerLock.Lock()) { if ((Phase != CcjRoundPhase.InputRegistration && Phase != CcjRoundPhase.ConnectionConfirmation) || Status != CcjRoundStatus.Running) { throw new InvalidOperationException("Removing Alice is only allowed in InputRegistration and ConnectionConfirmation phases."); } foreach (var id in ids) { numberOfRemovedAlices = Alices.RemoveAll(x => x.UniqueId == id); } } Logger.LogInfo <CcjRound>($"Round ({RoundId}): {numberOfRemovedAlices} alices are removed."); return(numberOfRemovedAlices); }