hashgraph / hedera-sdk-java

Hedera™ Hashgraph SDK for Java
https://docs.hedera.com/guides/docs/sdks
Apache License 2.0
229 stars 117 forks source link

NodeCreate and NodeUpdate have nullable fields that cannot be set to null #2091

Closed jbair06 closed 3 days ago

jbair06 commented 6 days ago

Problem

There are multiple fields in both NodeCreate and NodeUpdate that are either nullable, and shouldn't be, or are not nullable and maybe should be. In addition, the set methods prevent any field, even nullable fields, from being set to null.

As far as which fields should NOT be nullable, I would think that they all should be. The reason is that there is the case where a transaction may be partially completed, saved, then recreated from bytes. This process may chose to not set, or unset, a field. Not sure if there can be some validation in the freeze method to ensure require fields are set.

Two examples in NodeCreateTransaction:

Solution

NodeCreate and NodeUpdate should be revised to properly handle the nullability of fields in the transaction. This include adjusting the set methods as needed.

Alternatives

No response