X-Git-Url: https://git.novaco.in/?p=NovacoinLibrary.git;a=blobdiff_plain;f=Novacoin%2FCOutPoint.cs;h=07c65529b5c620e24a037c267ea8c5e7e5f97226;hp=b236ccd324eed05ad57e7dbce5420109b3e44df9;hb=4370732bca42bcd668c0cb3997b9268f88ca863e;hpb=f02df773a836f8b3df12bd21fd418f7c17b77821 diff --git a/Novacoin/COutPoint.cs b/Novacoin/COutPoint.cs index b236ccd..07c6552 100644 --- a/Novacoin/COutPoint.cs +++ b/Novacoin/COutPoint.cs @@ -25,7 +25,7 @@ using System.Text; namespace Novacoin { - public class COutPoint : IComparable, IEquatable + public class COutPoint : IComparable, IEquatable, IEqualityComparer { /// /// Hash of parent transaction. @@ -135,6 +135,27 @@ namespace Novacoin return (o.n == n) && (o.hash == hash); } + + /// + /// Equality comparer for outpoints. + /// + /// First outpoint. + /// Second outpoint. + /// Result of comparison. + public bool Equals(COutPoint x, COutPoint y) + { + return (x.n == y.n) && (x.hash == y.hash); + } + + public override int GetHashCode() + { + return n.GetHashCode() ^ hash.GetHashCode(); + } + + public int GetHashCode(COutPoint obj) + { + return obj.GetHashCode(); + } } }