3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-07 06:44:16 +00:00

Implement a couple of (weak) hashCode methods to go with equals(). Resolves issue 82.

This commit is contained in:
Mike Hearn 2011-09-18 19:54:03 +00:00
parent ba2255a185
commit 42b5a0d0ed
2 changed files with 11 additions and 0 deletions

View File

@ -125,4 +125,9 @@ public class PeerAddress extends Message {
other.services.equals(services) &&
other.time == time;
}
@Override
public int hashCode() {
return addr.hashCode() ^ port ^ (int)time ^ services.hashCode();
}
}

View File

@ -137,4 +137,10 @@ public class VersionMessage extends Message {
other.myAddr.equals(myAddr) &&
other.theirAddr.equals(theirAddr);
}
@Override
public int hashCode() {
return (int)bestHeight ^ clientVersion ^ (int)localServices ^ (int)time ^ subVer.hashCode() ^ myAddr.hashCode()
^ theirAddr.hashCode();
}
}