private void RejectTransaction(AcceptTransationAction action) { var involvedParties = action.Model.Transfers .SelectMany(x => new[] { x.GiverId, x.ReceiverId }) .Distinct() .ToList(); involvedParties.ForEach(ip => _actor.Account.DecreaseTrust(ip, UnaccountedTransactionDistrustFactor)); }
private void AccountTransaction(AcceptTransationAction action) { foreach (var transfer in action.Model.Transfers) { AccountTransfer(transfer); } if (_actor.Account.HasPendingTransaction(action.Model.Key)) { _actor.RelayTransactionAccepted(action.Model); } }
private void WhenAcceptTransaction(AcceptTransationAction action) { if (_actor.Account.HasReceivedTransaction(action.Model.Key)) { return; } _actor.Account.AddReceivedTransaction(action.Model.Key); if (_actor.VerifyTransaction(action.Model)) { AccountTransaction(action); } else { RejectTransaction(action); } }