Example #1
0
        /// <inheritdoc />
        public async Task <UnspentOutputs> GetUnspentTransactionAsync(uint256 trxid)
        {
            TxMempoolInfo txInfo = this.Info(trxid);

            if (txInfo == null)
            {
                this.logger.LogTrace("(-):[TX_IS_NULL]");
                return(null);
            }

            var memPoolCoinView = new MempoolCoinView(this.coinView, this.memPool, this.MempoolLock, this.Validator);

            await this.MempoolLock.ReadAsync(() => { memPoolCoinView.LoadViewLocked(txInfo.Trx); });

            UnspentOutputs unspentOutputs = memPoolCoinView.GetCoins(trxid);

            return(unspentOutputs);
        }
        /// <inheritdoc />
        public async Task <UnspentOutput> GetUnspentTransactionAsync(OutPoint outPoint)
        {
            TxMempoolInfo txInfo = this.Info(outPoint.Hash);

            if (txInfo == null)
            {
                this.logger.LogTrace("(-):[TX_IS_NULL]");
                return(null);
            }

            var memPoolCoinView = new MempoolCoinView(this.network, this.coinView, this.memPool, this.MempoolLock, this.Validator);

            await this.MempoolLock.ReadAsync(() => { memPoolCoinView.LoadViewLocked(txInfo.Trx); });

            UnspentOutput unspentOutput = memPoolCoinView.Set.AccessCoins(outPoint);

            return(unspentOutput);
        }