Exemplo n.º 1
0
        public List <TransactionVOut> GetAllTransactionVOutsForAddress(string addr)
        {
            var cmd = _unspentConnection.CreateCommand();

            cmd.CommandText = "SELECT * FROM unspent WHERE toaddr=$to AND spent='0';";
            cmd.Parameters.AddWithValue("to", addr);
            var reader = cmd.ExecuteReader();
            var ts     = new List <TransactionVOut>();

            while (reader.Read())
            {
                var trans = TransactionVOut.GetVoutFromSqlReader(reader);
                if (_blockChainService.IsBlockInLongestChain(trans.FromBlock))
                {
                    ts.Add(trans);
                }
            }

            return(ts);
        }