hedera-services
hedera-services copied to clipboard
`Hash` should become immutable
Having immutability of an instance is a good feature by itself. But right now, the driving force behind making Hash
immutable is the switch protobuf. Events will contain hashes that are immutable. Ideally, we would wrap these immutable objects with a Hash
instance instead of copying it. Because Hash
allows access to the underlying array, this is not possible.
Tasks
- Deprecate
Hash.getValue()
- Refactor usage of
Hash.getValue()
. This will have to be done on a case by case basis. Most of the time, helper methods should be able to provide the same functionality without access to the underlying array. In the case where this is not possible, we can create a copy if its not cost prohibitive. - Remove
Hash.getValue()
- Hashes from the PBJ records should simply wrap the
Bytes
provided