Beispiel #1
0
        public bool HaveInputs(Transaction tx)
        {
            if (!tx.IsCoinBase)
            {
                // first check whether information about the prevout hash is available
                foreach (var input in tx.Inputs)
                {
                    OutPoint prevout = input.PrevOut;
                    if (!HaveCoins(prevout.Hash))
                    {
                        return(false);
                    }
                }

                // then check whether the actual outputs are available
                foreach (var input in tx.Inputs)
                {
                    OutPoint prevout = input.PrevOut;
                    Coins    coins   = GetCoins(prevout.Hash);
                    if (!coins.IsAvailable(prevout.N))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Beispiel #2
0
        public TxOut GetOutputFor(TxIn input)
        {
            Coins coins = GetCoins(input.PrevOut.Hash);

            if (!coins.IsAvailable(input.PrevOut.N))
            {
                return(null);
            }
            return(coins.Outputs[(int)input.PrevOut.N]);
        }