[BUG] Relay invoices are not retried when local persistence fails

Open
#312 5 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@Mansi2007275 is already working on this.

Since Oct 21, 2026.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript

Research direction

Read frontend/src/page/ReceivedInvoice.jsx around storeRelayInvoice() and the initial catch-up setup, then trace retry and deduplication in frontend/src/services/relay/relayInvoiceMessaging.js. Start with the existing retry test in frontend/tests/services/relayInvoiceMessaging.test.js and add coverage for failed persistence in both paths. Done means the message is retried after a transient save failure and appears once persistence succeeds.

Written by the indexing model from the issue text.

Description

bug
Bug Description

[BUG] Relay invoices are not retried when local persistence fails

Bug Description

The Received Invoices relay flow can permanently skip a message for the current session when saving its verified invoice payload to IndexedDB fails.

In frontend/src/page/ReceivedInvoice.jsx, storeRelayInvoice() catches storage errors and returns false. However, the initial catch-up passes every fetched message ID into knownMessageIds, including messages that failed to save.

The live polling path has a related issue: its onInvoice callback does not throw when storeRelayInvoice() returns false. In frontend/src/services/relay/relayInvoiceMessaging.js, the poller retries a message only when its handler throws. Therefore, a failed save can also be treated as successfully handled during live polling.

Affected Code

  • frontend/src/page/ReceivedInvoice.jsx — storeRelayInvoice() error handling and initial catch-up/poll setup, approximately lines 903–963.
  • frontend/src/services/relay/relayInvoiceMessaging.js — message deduplication and retry behavior, approximately lines 180–205.
  • frontend/tests/services/relayInvoiceMessaging.test.js — existing test for retrying when the handler throws.

Steps to Reproduce

  1. Open Received Invoices with relay messaging configured.
  2. Deliver a valid invoice message.
  3. Simulate an IndexedDB write failure while the application processes the message.
  4. Allow the next polling cycle to run with the same relay message available.

Actual Behavior

The failed invoice may not appear in Received Invoices, and the message may be skipped for the remainder of the session because its ID has already been marked as seen.

Reloading the application may trigger another initial catch-up and allow the invoice to be saved if storage is working again.

Expected Behavior

A message should only be considered successfully processed after its verified invoice payload has been persisted, or otherwise handled according to an explicit permanent-failure policy.

Transient storage failures should leave the message eligible for retry in both the initial catch-up and live polling paths.

Suggested Regression Test

Simulate a valid relay message whose local persistence fails once and succeeds on a subsequent attempt. Verify that the message is retried without requiring an application reload and that it appears once persistence succeeds.

Cover both:

  • Initial catch-up where storeRelayInvoice() returns false.
  • Live polling where the storage failure is caught inside storeRelayInvoice().

Verification Status

The control-flow problem is supported by source inspection. Runtime reproduction and frontend tests have not been completed in the inspected checkout because the required Jest dependencies were unavailable.

Steps to Reproduce

No response

Logs and Screenshots

No response

Environment Details

No response

Impact

Critical - Application is unusable

Code of Conduct
  • I have joined the Discord server and will post updates there
  • I have searched existing issues to avoid duplicates
Dominant language
JavaScript
Stars
13
Forks
62
Avg merge
2d 14h
Merged PRs (30d)
18

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from StabilityNexus/Chainvoice

All issues in StabilityNexus/Chainvoice

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.