Exemplo n.º 1
0
        public override TransactionOutput GetUnspent(UInt256 hash, ushort index)
        {
            ReadOptions options = new ReadOptions();

            using (options.Snapshot = db.GetSnapshot())
            {
                UnspentCoinState state = db.TryGet <UnspentCoinState>(options, DataEntryPrefix.ST_Coin, hash);
                if (state == null)
                {
                    return(null);
                }
                if (index >= state.Items.Length)
                {
                    return(null);
                }
                if (state.Items[index].HasFlag(CoinState.Spent))
                {
                    return(null);
                }
                int height;
                return(GetTransaction(options, hash, out height).Outputs[index]);
            }
        }