Exemplo n.º 1
0
        public static string GenerateMessage(SuspicionData susInfo)
        {
            StringBuilder sb = new StringBuilder($"Suspicion Level: {susInfo.SuspicionDegree}!");

            sb.AppendLine();
            sb.AppendLine($"https://xmrchain.net/tx/{susInfo.TxHash}");
            sb.AppendLine();
            if (susInfo.ViolationData.IsDoubleSpend)
            {
                sb.AppendLine($"Double Spend Found!");
            }
            if (susInfo.ViolationData.UnlockTimeViolation)
            {
                sb.AppendLine($"Unlock Time is greater than 0! (unlock_time = {susInfo.UnlockTime})");
                if (susInfo.UnlockTime < 1_000_000)
                {
                    sb.AppendLine($"You also misused this field! unlock_time is absolute block height, not relative block height!");
                }
            }
            if (susInfo.ViolationData.FeeViolation)
            {
                sb.AppendLine($"Very large fee! ({MoneroDenominationConverter.PiconeroToMonero(susInfo.Fee):N12} XMR)");
            }
            if (susInfo.ViolationData.NonDefaultExtraField)
            {
                sb.AppendLine($"This transactions 'extra' field is packed. Either you're using a PaymentID, or including other information in this field.");
            }
            sb.AppendLine();
            sb.AppendLine($"#monero #privacy");
            return(sb.ToString());
        }
Exemplo n.º 2
0
        private static (SuspicionDegree Degree, SuspicionData SuspicionData) GetSuspicionDegree(MemoryPoolTransaction tx)
        {
            // Lets drill down into the information...
            var  json   = JsonSerializer.Deserialize <MemoryPoolTransactionJsonDecoding>(tx.AsJson, null);
            var  vd     = GetViolationData(tx, json);
            uint score  = GetViolationScore(vd);
            var  degree = SuspicionDegreeCalculator.GetSuspicionDegree(score);

            SuspicionData suspicionData = null;
            bool          isSuspicious  = IsSuspicious(degree);

            if (isSuspicious)
            {
                suspicionData = new SuspicionData(tx.TxHash, degree)
                {
                    ViolationData = vd,
                    UnlockTime    = json.UnlockTime,
                    Fee           = json.RingSignature.Fee,
                }
            }
            ;

            return(degree, suspicionData);
        }