Beispiel #1
0
        private bool ValidateDoubleSpend()
        {
            var inputs = Bitcoin.TransactionPool
                         .SelectMany(x => x.InputList)
                         .Distinct();

            foreach (var item in inputs)
            {
                var utxo = UtxoSet.Where(x => x.TxId == item.TxId && x.vOut == item.VOut);
                if (utxo != null && utxo.Count() > 1)
                {
                    return(false);
                }
            }
            return(true);
        }
Beispiel #2
0
        private decimal ReturnSumInputs()
        {
            var inputs = Bitcoin.TransactionPool
                         .SelectMany(x => x.InputList)
                         .Distinct();

            decimal sumInputs = 0;

            foreach (var item in inputs)
            {
                var utxo = UtxoSet.FirstOrDefault(x => x.TxId == item.TxId && x.vOut == item.VOut);
                if (utxo != null)
                {
                    sumInputs += utxo.Value;
                }
            }
            sumInputs += UtxoSet.Where(x => x.Address == AddressMiner && x.TxId == "0000000000").Sum(x => x.Value);

            return(sumInputs);
        }