Skip to content

fix: reset Hermes failure count after successful promise - #6219

Open
kapunakap wants to merge 1 commit into
mysteriumnetwork:masterfrom
kapunakap:fix/reset-hermes-failure-count-on-success
Open

kapunakap wants to merge 1 commit into
mysteriumnetwork:masterfrom
kapunakap:fix/reset-hermes-failure-count-on-success

Conversation

@kapunakap

Copy link
Copy Markdown

What

HermesPromiseHandler.RequestPromise reports failures by sending an error on its result channel and reports success by closing that channel without sending a value.

InvoiceTracker.handlePromiseErrors currently forwards only values received from that channel. As a result, a successful promise request never reaches handleHermesError(nil), so hermesFailureCount is not reset after success. Retryable Hermes failures can therefore accumulate across successful promise requests even though the configured limit is intended to cover failures "in a row".

This change treats a clean result-channel close as a successful completion and forwards nil to the existing Hermes error handler. If the channel emitted any result, closing it does not synthesize an additional success result.

The forwarding is also stop-aware so a late result cannot block the helper after the invoice tracker has stopped.

Tests

Added regression coverage that verifies:

  • a clean promise-result channel close reports successful completion;
  • an error followed by channel close does not produce a false success;
  • successful completion resets an existing Hermes failure count.

Related to #6218. This is a narrow payment-engine correctness fix; it does not claim to resolve all connection churn described there.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant