Browse Source

OnlineAccountData no longer uses signature in equals() or hashCode() because newer aggregate signatures use random nonces and OAD class doesn't care about / verify sigs

reduce-reward-shares
catbref 2 years ago
parent
commit
d9b330b46a
  1. 10
      src/main/java/org/qortal/data/network/OnlineAccountData.java

10
src/main/java/org/qortal/data/network/OnlineAccountData.java

@ -66,13 +66,11 @@ public class OnlineAccountData {
if (otherOnlineAccountData.timestamp != this.timestamp) if (otherOnlineAccountData.timestamp != this.timestamp)
return false; return false;
// Signature more likely to be unique than public key
if (!Arrays.equals(otherOnlineAccountData.signature, this.signature))
return false;
if (!Arrays.equals(otherOnlineAccountData.publicKey, this.publicKey)) if (!Arrays.equals(otherOnlineAccountData.publicKey, this.publicKey))
return false; return false;
// We don't compare signature because it's not our remit to verify and newer aggregate signatures use random nonces
return true; return true;
} }
@ -81,8 +79,8 @@ public class OnlineAccountData {
int h = this.hash; int h = this.hash;
if (h == 0) { if (h == 0) {
this.hash = h = Long.hashCode(this.timestamp) this.hash = h = Long.hashCode(this.timestamp)
^ Arrays.hashCode(this.publicKey) ^ Arrays.hashCode(this.publicKey);
^ Arrays.hashCode(this.signature); // We don't use signature because newer aggregate signatures use random nonces
} }
return h; return h;
} }

Loading…
Cancel
Save