@@ -24,10 +24,11 @@ const maxAttempts = 10
2424type _ExecutionState uint32
2525
2626const (
27- executionStateRetry _ExecutionState = 0
28- executionStateFinished _ExecutionState = 1
29- executionStateError _ExecutionState = 2
30- executionStateExpired _ExecutionState = 3
27+ executionStateRetry _ExecutionState = 0
28+ executionStateFinished _ExecutionState = 1
29+ executionStateError _ExecutionState = 2
30+ executionStateExpired _ExecutionState = 3
31+ executionStateRetryWithAnotherNode _ExecutionState = 4
3132)
3233
3334type Executable interface {
@@ -213,7 +214,6 @@ func _Execute(client *Client, e Executable) (interface{}, error) {
213214 } else {
214215 requestTimeout = client .GetRequestTimeout ()
215216 }
216-
217217 startTime := time .Now ()
218218 for attempt = int64 (0 ); attempt < int64 (maxAttempts ); attempt ++ {
219219 if time .Since (startTime ) >= requestTimeout {
@@ -296,9 +296,9 @@ func _Execute(client *Client, e Executable) (interface{}, error) {
296296 }
297297
298298 if err != nil {
299+ e .advanceRequest ()
299300 errPersistent = err
300301 if _ExecutableDefaultRetryHandler (e .getLogID (e ), err , txLogger ) {
301- e .advanceRequest ()
302302 client .network ._IncreaseBackoff (node )
303303 continue
304304 }
@@ -355,6 +355,15 @@ func _Execute(client *Client, e Executable) (interface{}, error) {
355355 case executionStateFinished :
356356 txLogger .Trace ("finished" , "Response Proto" , hex .EncodeToString (marshaledResponse ))
357357 return e .mapResponse (resp , node .accountID , protoRequest )
358+ case executionStateRetryWithAnotherNode :
359+ errPersistent = statusError
360+ e .advanceRequest ()
361+ txLogger .Trace ("received `INVALID_NODE_ACCOUNT`; updating addressbook and marking node as unhealthy" , "requestId" , e .getLogID (e ), "nodeAccountId" , node .accountID )
362+ defer client ._UpdateAddressBook ()
363+ // mark this node as unhealthy
364+ client .network ._IncreaseBackoff (node )
365+ // continue with other nodes
366+ continue
358367 }
359368 }
360369
0 commit comments