Skip to content

Commit a3d28b1

Browse files
committed
hip 1299 - switch error from INVALID_NODE_ACCOUNT_ID to INVALID_NODE_ACCOUNT
Signed-off-by: emiliyank <e.kadiyski@gmail.com>
1 parent c25d9cd commit a3d28b1

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

sdk/src/main/java/com/hedera/hashgraph/sdk/Executable.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -442,10 +442,10 @@ public O execute(Client client, Duration timeout) throws TimeoutException, Prech
442442
lastException = grpcRequest.mapStatusException();
443443
advanceRequest(); // Advance to next node before retrying
444444

445-
// Handle INVALID_NODE_ACCOUNT_ID after advancing (matches Go SDK's executionStateRetryWithAnotherNode)
446-
if (status == Status.INVALID_NODE_ACCOUNT_ID) {
445+
// Handle INVALID_NODE_ACCOUNT after advancing (matches Go SDK's executionStateRetryWithAnotherNode)
446+
if (status == Status.INVALID_NODE_ACCOUNT) {
447447
logger.trace(
448-
"Received INVALID_NODE_ACCOUNT_ID; updating address book and marking node {} as unhealthy, attempt #{}",
448+
"Received INVALID_NODE_ACCOUNT; updating address book and marking node {} as unhealthy, attempt #{}",
449449
node.getAccountId(),
450450
attempt);
451451
// Schedule async address book update (matches Go's defer client._UpdateAddressBook())
@@ -790,10 +790,10 @@ private void executeAsyncInternal(
790790
case SERVER_ERROR:
791791
advanceRequest(); // Advance to next node before retrying
792792

793-
// Handle INVALID_NODE_ACCOUNT_ID after advancing (matches Go SDK's executionStateRetryWithAnotherNode)
794-
if (status == Status.INVALID_NODE_ACCOUNT_ID) {
793+
// Handle INVALID_NODE_ACCOUNT after advancing (matches Go SDK's executionStateRetryWithAnotherNode)
794+
if (status == Status.INVALID_NODE_ACCOUNT) {
795795
logger.trace(
796-
"Received INVALID_NODE_ACCOUNT_ID; updating address book and marking node {} as unhealthy, attempt #{}",
796+
"Received INVALID_NODE_ACCOUNT; updating address book and marking node {} as unhealthy, attempt #{}",
797797
grpcRequest.getNode().getAccountId(),
798798
attempt);
799799
// Schedule async address book update (matches Go's defer client._UpdateAddressBook())
@@ -901,9 +901,10 @@ ExecutionState getExecutionState(Status status, ResponseT response) {
901901
return ExecutionState.SERVER_ERROR;
902902
case BUSY:
903903
return ExecutionState.RETRY;
904-
case INVALID_NODE_ACCOUNT_ID:
904+
case INVALID_NODE_ACCOUNT:
905905
// Matches Go SDK's executionStateRetryWithAnotherNode behavior:
906906
// immediately retry with next node without delay
907+
// This occurs when a node's account ID has changed
907908
return ExecutionState.SERVER_ERROR;
908909
case OK:
909910
return ExecutionState.SUCCESS;
@@ -1010,9 +1011,9 @@ O mapResponse() {
10101011
}
10111012

10121013
void handleResponse(ResponseT response, Status status, ExecutionState executionState, @Nullable Client client) {
1013-
// Note: For INVALID_NODE_ACCOUNT_ID, we don't mark the node as unhealthy here
1014+
// Note: For INVALID_NODE_ACCOUNT, we don't mark the node as unhealthy here
10141015
// because we need to do it AFTER advancing the request, to match Go SDK behavior
1015-
if (status != Status.INVALID_NODE_ACCOUNT_ID) {
1016+
if (status != Status.INVALID_NODE_ACCOUNT) {
10161017
node.decreaseBackoff();
10171018
}
10181019

@@ -1042,9 +1043,9 @@ void handleResponse(ResponseT response, Status status, ExecutionState executionS
10421043
verboseLog(node);
10431044
}
10441045
case SERVER_ERROR -> {
1045-
// Note: INVALID_NODE_ACCOUNT_ID is handled after advanceRequest() in execute methods
1046+
// Note: INVALID_NODE_ACCOUNT is handled after advanceRequest() in execute methods
10461047
// to match Go SDK's executionStateRetryWithAnotherNode behavior
1047-
if (status != Status.INVALID_NODE_ACCOUNT_ID) {
1048+
if (status != Status.INVALID_NODE_ACCOUNT) {
10481049
logger.warn(
10491050
"Problem submitting request to node {} for attempt #{}, retry with new node: {}",
10501051
node.getAccountId(),

sdk/src/test/java/com/hedera/hashgraph/sdk/ExecutableTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,9 @@ void shouldRetryReturnsCorrectStates() {
512512
.isEqualTo(ExecutionState.SERVER_ERROR);
513513
assertThat(tx.getExecutionState(Status.PLATFORM_NOT_ACTIVE, null)).isEqualTo(ExecutionState.SERVER_ERROR);
514514
assertThat(tx.getExecutionState(Status.BUSY, null)).isEqualTo(ExecutionState.RETRY);
515-
// INVALID_NODE_ACCOUNT_ID now returns SERVER_ERROR to match Go SDK's executionStateRetryWithAnotherNode
515+
// INVALID_NODE_ACCOUNT now returns SERVER_ERROR to match Go SDK's executionStateRetryWithAnotherNode
516516
// which immediately retries with another node without delay
517-
assertThat(tx.getExecutionState(Status.INVALID_NODE_ACCOUNT_ID, null)).isEqualTo(ExecutionState.SERVER_ERROR);
517+
assertThat(tx.getExecutionState(Status.INVALID_NODE_ACCOUNT, null)).isEqualTo(ExecutionState.SERVER_ERROR);
518518
assertThat(tx.getExecutionState(Status.OK, null)).isEqualTo(ExecutionState.SUCCESS);
519519
assertThat(tx.getExecutionState(Status.ACCOUNT_DELETED, null)).isEqualTo(ExecutionState.REQUEST_ERROR);
520520
}

sdk/src/testIntegration/java/com/hedera/hashgraph/sdk/test/integration/NodeUpdateAccountIdIntegrationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ void testNodeUpdateTransactionCanChangeNodeAccountUpdateAddressbookAndRetry() th
127127
var newAccountKey = PrivateKey.generateED25519();
128128

129129
// Submit to node 3 and node 4
130-
// Node 3 will fail with INVALID_NODE_ACCOUNT_ID (because it now uses newNodeAccountID)
130+
// Node 3 will fail with INVALID_NODE_ACCOUNT (because it now uses newNodeAccountID)
131131
// The SDK should automatically:
132-
// 1. Detect INVALID_NODE_ACCOUNT_ID error
132+
// 1. Detect INVALID_NODE_ACCOUNT error
133133
// 2. Advance to next node
134134
// 3. Update the address book asynchronously
135135
// 4. Mark node 3 as unhealthy

0 commit comments

Comments
 (0)