Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ranlavanet committed Sep 8, 2024
1 parent 338d0fb commit 62e4d9f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions protocol/common/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ type RelayResult struct {
StatusCode int
Quorum int
ProviderTrailer metadata.MD // the provider trailer attached to the request. used to transfer useful information (which is not signed so shouldn't be trusted completely).
IsNodeError bool
}

func (rr *RelayResult) GetReplyServer() pairingtypes.Relayer_RelaySubscribeClient {
Expand Down
7 changes: 3 additions & 4 deletions protocol/rpcconsumer/rpcconsumer_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,9 +757,9 @@ func (rpccs *RPCConsumerServer) sendRelayToProvider(
}

errResponse = rpccs.consumerSessionManager.OnSessionDone(singleConsumerSession, latestBlock, chainlib.GetComputeUnits(protocolMessage), relayLatency, singleConsumerSession.CalculateExpectedLatency(expectedRelayTimeoutForQOS), expectedBH, numOfProviders, pairingAddressesLen, protocolMessage.GetApi().Category.HangingApi) // session done successfully

isNodeError, _ := protocolMessage.CheckResponseError(localRelayResult.Reply.Data, localRelayResult.StatusCode)
localRelayResult.IsNodeError = isNodeError
if rpccs.cache.CacheActive() && rpcclient.ValidateStatusCodes(localRelayResult.StatusCode, true) == nil {
isNodeError, _ := protocolMessage.CheckResponseError(localRelayResult.Reply.Data, localRelayResult.StatusCode)
// in case the error is a node error we don't want to cache
if !isNodeError {
// copy reply data so if it changes it doesn't panic mid async send
Expand Down Expand Up @@ -1314,8 +1314,7 @@ func (rpccs *RPCConsumerServer) appendHeadersToRelayResult(ctx context.Context,
})

// add is node error flag
isNodeError, _ := protocolMessage.CheckResponseError(relayResult.Reply.Data, relayResult.StatusCode)
if isNodeError {
if relayResult.IsNodeError {
metadataReply = append(metadataReply,
pairingtypes.Metadata{
Name: common.LAVA_IDENTIFIED_NODE_ERROR_HEADER,
Expand Down

0 comments on commit 62e4d9f

Please sign in to comment.