Simplify RPCID

This commit is contained in:
Ben van Hartingsveldt 2025-07-12 17:16:29 +02:00
parent b7c6a7b45a
commit aff5eb6cf4
No known key found for this signature in database
GPG key ID: 261AA214130CE7AB
2 changed files with 11 additions and 6 deletions

View file

@ -146,17 +146,21 @@ public class DHT{
public static class RPCID{ public static class RPCID{
private final DHT.Message<?> message; private final byte[] id;
public RPCID(DHT.Message<?> message){ public RPCID(byte[] id){
this.message = message; this.id = id;
}
public RPCID(Message<?> message){
this(message.rpcID);
} }
@Override @Override
public boolean equals(Object obj){ public boolean equals(Object obj){
if(obj instanceof RPCID){ if(obj instanceof RPCID){
RPCID other = (RPCID) obj; RPCID other = (RPCID) obj;
return Arrays.equals(this.message.rpcID,other.message.rpcID);// && Arrays.equals(this.message.nodeID,other.nodeID); return Arrays.equals(this.id,other.id);
} }
return super.equals(obj); return super.equals(obj);
} }
@ -169,9 +173,10 @@ public class DHT{
@Override @Override
public String toString() { public String toString() {
return "RPCID{" + return "RPCID{" +
"rpcID=" + Hex.encode(this.message.rpcID) + "id=" + Hex.encode(id) +
'}'; '}';
} }
} }
} }

View file

@ -43,7 +43,7 @@ const POINT_COLOR = {
}; };
const POINT_TTL = { const POINT_TTL = {
blockchain: 60, blockchain: 60 * 2,
}; };
const POINT_RADIUS = { const POINT_RADIUS = {