mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-13 02:35:52 +00:00
TransactionOutput: take parent hash and index into account in the hashcode. Inserting TransactionOutput's with identical scripts/values but different outpoints into a hashset will work properly now.
This commit is contained in:
parent
c0297f2c12
commit
821de89e69
@ -461,6 +461,10 @@ public class TransactionOutput extends ChildMessage implements Serializable {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 31 * (int) value + (scriptBytes != null ? Arrays.hashCode(scriptBytes) : 0);
|
||||
int result = (int) (value ^ (value >>> 32));
|
||||
result = 31 * result + Arrays.hashCode(scriptBytes);
|
||||
if (parent != null)
|
||||
result *= parent.getHash().hashCode() + getIndex();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user