Skip to content

Commit

Permalink
fix: NodeUpdateTransaction sets description as empty string (#2096)
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Ivanov <[email protected]>
  • Loading branch information
0xivanov authored Nov 22, 2024
1 parent d719e27 commit e5abcca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,9 @@ void initFromTransactionBody() {
accountId = AccountId.fromProtobuf(body.getAccountId());
}

description = body.getDescription().getValue();
if (body.hasDescription()) {
description = body.getDescription().getValue();
}

for (var gossipEndpoint : body.getGossipEndpointList()) {
gossipEndpoints.add(Endpoint.fromProtobuf(gossipEndpoint));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,13 @@ void shouldBytes() throws Exception {
}

@Test
void testNullCertificates() throws Exception {
void testNullOptionalValues() throws Exception {
var tx = new NodeUpdateTransaction();
var tx2Bytes = tx.toBytes();
NodeUpdateTransaction deserializedTx = (NodeUpdateTransaction) Transaction.fromBytes(tx2Bytes);
assertThat(deserializedTx.getGossipCaCertificate()).isNull();
assertThat(deserializedTx.getGrpcCertificateHash()).isNull();
assertThat(deserializedTx.getDescription()).isNull();
}

@Test
Expand Down

0 comments on commit e5abcca

Please sign in to comment.