diff --git a/core/src/main/java/com/google/bitcoin/core/InventoryItem.java b/core/src/main/java/com/google/bitcoin/core/InventoryItem.java index dc7aeadb6..e69d0f552 100644 --- a/core/src/main/java/com/google/bitcoin/core/InventoryItem.java +++ b/core/src/main/java/com/google/bitcoin/core/InventoryItem.java @@ -42,4 +42,14 @@ public class InventoryItem { public String toString() { return type.toString() + ": " + hash; } + + public int hashCode() { + return hash.hashCode() + type.ordinal(); + } + + public boolean equals(Object o) { + return o instanceof InventoryItem && + ((InventoryItem)o).type == this.type && + ((InventoryItem)o).hash.equals(this.hash); + } }