예제 #1
0
        internal void KnownKeyPathMappingUpdated()
        {
            if (Transaction == null)
            {
                return;
            }
            var scriptPubKey = (TrackedSource as IDestination)?.ScriptPubKey;

            for (int i = 0; i < Transaction.Outputs.Count; i++)
            {
                var output = Transaction.Outputs[i];
                if (KnownKeyPathMapping.ContainsKey(output.ScriptPubKey) || scriptPubKey == output.ScriptPubKey)
                {
                    ReceivedCoins.Add(new Coin(new OutPoint(Key.TxId, i), output));
                }
            }
            SpentOutpoints.AddRange(Transaction.Inputs.Select(input => input.PrevOut));
        }
 public virtual IEnumerable <Coin> GetCoins()
 {
     if (_CoinsData is null)
     {
         int idx = -1;
         foreach (var output in Transaction.Outputs)
         {
             idx++;
             if (KnownKeyPathMapping.ContainsKey(output.ScriptPubKey))
             {
                 yield return(new Coin(new OutPoint(Key.TxId, idx), output));
             }
         }
     }
     else
     {
         foreach (var coinData in _CoinsData)
         {
             yield return(new Coin(new OutPoint(Key.TxId, (int)coinData.Index), coinData.TxOut));
         }
     }
 }