Skip to content

Commit ee72959

Browse files
committed
regenerate equals and hashcode for enr record
Signed-off-by: Usman Saleem <[email protected]>
1 parent f946dbb commit ee72959

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/EthereumNodeRecord.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.Arrays;
2525
import java.util.HashMap;
2626
import java.util.Map;
27+
import java.util.Objects;
2728
import java.util.Optional;
2829

2930
import org.apache.tuweni.bytes.Bytes;
@@ -138,16 +139,16 @@ public String toString() {
138139

139140
/** Override equals method to compare the RLP bytes */
140141
@Override
141-
public boolean equals(final Object o) {
142-
if (this == o) return true;
143-
if (o == null || getClass() != o.getClass()) return false;
144-
EthereumNodeRecord that = (EthereumNodeRecord) o;
145-
return rlp.equals(that.rlp);
142+
public boolean equals(Object o) {
143+
if (!(o instanceof EthereumNodeRecord that)) {
144+
return false;
145+
}
146+
return Objects.equals(rlp, that.rlp);
146147
}
147148

148149
/** Override hashCode method to use hashCode of the RLP bytes */
149150
@Override
150151
public int hashCode() {
151-
return rlp.hashCode();
152+
return Objects.hashCode(rlp);
152153
}
153154
}

0 commit comments

Comments
 (0)