mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-10 08:27:04 +00:00
Op instances key Timestamp.ops (MutableMap<Op, Timestamp>), so contract violations corrupt hash-map behavior: - OpKECCAK256 defined equals without hashCode, so equal instances hashed by identity — two equal keys could land in different buckets, producing duplicate branches or failed lookups in keccak256 timestamp trees. Add hashCode = TAG, mirroring OpSHA1/OpSHA256/OpRIPEMD160. - OpBinary defined hashCode without equals — and its TAG referenced Op.TAG (0x00), a no-op XOR. Define the equals/hashCode pair once on OpBinary using tag() and drop the duplicated overrides from OpAppend/OpPrepend (behavior unchanged: same tag + same arg content). - VerifyResult.equals cast without a type test (ClassCastException on foreign types instead of false) and hashCode force-cast the nullable timestamp (NPE for null-timestamp results). Convert to a data class; the custom toString and compareTo stay.