Exemplo n.º 1
0
        List <TransactionInformationMatch> ToMatch(AnnotatedTransactionCollection txs,
                                                   List <TxOut> outputs,
                                                   DerivationStrategyBase derivation,
                                                   Repository.TransactionMiniKeyInformation[] keyInformations)
        {
            var result = new List <TransactionInformationMatch>();

            for (int i = 0; i < outputs.Count; i++)
            {
                if (outputs[i] == null)
                {
                    continue;
                }
                var keyPath = txs.GetKeyPath(outputs[i].ScriptPubKey);
                if (keyPath == null)
                {
                    continue;
                }

                result.Add(new TransactionInformationMatch()
                {
                    Index = i, KeyPath = keyPath, Value = outputs[i].Value
                });
            }
            return(result);
        }
Exemplo n.º 2
0
 private void FillUTXOsInformation(List <UTXO> utxos, AnnotatedTransactionCollection transactions, int currentHeight)
 {
     for (int i = 0; i < utxos.Count; i++)
     {
         var utxo = utxos[i];
         utxo.KeyPath = transactions.GetKeyPath(utxo.ScriptPubKey);
         utxo.Feature = DerivationStrategyBase.GetFeature(utxo.KeyPath);
         var txHeight = transactions.GetByTxId(utxo.Outpoint.Hash)
                        .Select(t => t.Height)
                        .Where(h => h.HasValue)
                        .Select(t => t.Value)
                        .Concat(MaxValue)
                        .Min();
         var firstSeen = transactions
                         .GetByTxId(utxo.Outpoint.Hash)
                         .Select(o => o.Record.FirstSeen)
                         .FirstOrDefault();
         var isUnconf = txHeight == MaxValue[0];
         utxo.Confirmations = isUnconf ? 0 : currentHeight - txHeight + 1;
         utxo.Timestamp     = firstSeen;
     }
 }
Exemplo n.º 3
0
        List <TransactionInformationMatch> ToMatch(AnnotatedTransactionCollection txs,
                                                   List <TxOut> outputs,
                                                   TrackedSource derivation)
        {
            var result = new List <TransactionInformationMatch>();

            for (int i = 0; i < outputs.Count; i++)
            {
                if (outputs[i] == null)
                {
                    continue;
                }
                if (!IsMatching(derivation, outputs[i].ScriptPubKey, txs))
                {
                    continue;
                }
                var keyPath = txs.GetKeyPath(outputs[i].ScriptPubKey);
                result.Add(new TransactionInformationMatch()
                {
                    Index = i, KeyPath = keyPath, Value = outputs[i].Value
                });
            }
            return(result);
        }