If we compare IVs, they of course must properly implement the equals method
This fixes the bug where we would request objects again that were already stored.
This commit is contained in:
parent
ceae11b5c6
commit
2cd857dd36
@ -21,6 +21,7 @@ import ch.dissem.bitmessage.utils.Strings;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Created by chris on 13.03.15.
|
||||
@ -31,6 +32,22 @@ public class InventoryVector implements Streamable {
|
||||
*/
|
||||
private final byte[] hash;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof InventoryVector)) return false;
|
||||
|
||||
InventoryVector that = (InventoryVector) o;
|
||||
|
||||
return Arrays.equals(hash, that.hash);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return hash != null ? Arrays.hashCode(hash) : 0;
|
||||
}
|
||||
|
||||
public byte[] getHash() {
|
||||
return hash;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user