public static TransactionResultTypes IsJoinValid(CoreAccount coreAccount, ServiceAccount chainAccount, JoinServiceTransaction transaction) { if (coreAccount == null) { return(TransactionResultTypes.InvalidTransaction); } if (transaction == null) { return(TransactionResultTypes.InvalidTransaction); } if (!transaction.IsSignatureValid(coreAccount.AccountKey)) { return(TransactionResultTypes.InvalidSignature); } var chainKey = transaction.AccountKey; if (chainKey == null && chainAccount != null) { return(TransactionResultTypes.AlreadyJoined); } if (chainKey != null && chainAccount != null) { if (chainAccount.ContainsAccountKeyKey(chainKey)) { return(TransactionResultTypes.AlreadyJoined); } if (chainAccount.HasAccountKeyIndex(chainKey.KeyIndex)) { return(TransactionResultTypes.InvalidServiceAccountKey); } if (chainKey.KeyIndex != chainAccount.AccountKeyCount) { return(TransactionResultTypes.InvalidServiceAccountKey); } } return(TransactionResultTypes.Ok); }