override equals and hashcode for sp address

This commit is contained in:
Craig Raw 2025-09-04 16:35:55 +02:00
parent da736c8cef
commit 7c0aa1545d

View file

@ -56,4 +56,26 @@ public class SilentPaymentAddress {
return new SilentPaymentAddress(scanPubKey, spendPubKey);
}
@Override
public String toString() {
return getAddress();
}
@Override
public final boolean equals(Object o) {
if(this == o) {
return true;
}
if(!(o instanceof SilentPaymentAddress that)) {
return false;
}
return getAddress().equals(that.getAddress());
}
@Override
public int hashCode() {
return getAddress().hashCode();
}
}