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:
parent
ba2255a185
commit
42b5a0d0ed
@ -125,4 +125,9 @@ public class PeerAddress extends Message {
|
|||||||
other.services.equals(services) &&
|
other.services.equals(services) &&
|
||||||
other.time == time;
|
other.time == time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return addr.hashCode() ^ port ^ (int)time ^ services.hashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,4 +137,10 @@ public class VersionMessage extends Message {
|
|||||||
other.myAddr.equals(myAddr) &&
|
other.myAddr.equals(myAddr) &&
|
||||||
other.theirAddr.equals(theirAddr);
|
other.theirAddr.equals(theirAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return (int)bestHeight ^ clientVersion ^ (int)localServices ^ (int)time ^ subVer.hashCode() ^ myAddr.hashCode()
|
||||||
|
^ theirAddr.hashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user