public override bool Equals(object obj) { CorrelationId item = obj as CorrelationId; if (item == null) { return(false); } return(_Id.Equals(item._Id)); }
public override bool Equals(object obj) { ExtPubKey item = obj as ExtPubKey; if (item == null) { return(false); } return(Hash.Equals(item.Hash)); }
/// <summary> Track a transaction </summary> /// <returns>False if not found. When confirms, it starts tracking. If too old you need to resync the chain.</returns> public bool Track(uint256 transactionId) { if (TrackedTransactions.Keys.Contains(transactionId)) { var tracked = TrackedTransactions.First(x => x.Key.Equals(transactionId)); if (tracked.Value == -1) { return(false); } else { return(true); } } TrackedTransactions.AddOrReplace(transactionId, -1); Transaction transaction = null; Block block = null; foreach (var b in FullBlockBuffer.Values) { Transaction tx = b.Transactions.FirstOrDefault(x => transactionId.Equals(x.GetHash())); if (tx != default(Transaction)) { transaction = tx; block = b; break; } } // This warning doesn't make sense: // ReSharper disable once ConditionIsAlwaysTrueOrFalse if (block == null || transaction == null) { return(false); } else { PartialBlock partialBlock = Chain.First(x => block.Header.GetHash().Equals(x.Value.MerkleProof.Header.GetHash())).Value; partialBlock.Transactions.Add(transaction); var transactionHashes = partialBlock.MerkleProof.PartialMerkleTree.GetMatchedTransactions() as HashSet <uint256>; transactionHashes.Add(transaction.GetHash()); partialBlock.MerkleProof = block.Filter(transactionHashes.ToArray()); return(true); } }