Skip to content

fix(wallets): prevent account-change listener leak on reconnect in XBullAdapter (closes #840) - #841

Closed
guptakumarranjeet150 wants to merge 1 commit into
Stellar-split:mainfrom
guptakumarranjeet150:fix/xbull-adapter-listener-leak
Closed

guptakumarranjeet150 wants to merge 1 commit into
Stellar-split:mainfrom
guptakumarranjeet150:fix/xbull-adapter-listener-leak

Conversation

@guptakumarranjeet150

Copy link
Copy Markdown

Summary

Closes #840

Fixes account-change listener leakage in by unsubscribing the previous registration before registering a new one during repeated invocations, ensuring at most one active listener is maintained with the wallet and preventing post-disconnect state mutation.

Key Changes

  • Listener Teardown Guard ():
    • In , explicitly invokes and sets before re-registering with .
    • Mirrors behavior of sibling and prevents orphaned listener callbacks from mutating after .
  • Unit Test Suite ():
    • Validates initial single registration upon .
    • Validates multiple sequential calls clean up prior listeners and leave strictly 1 live listener.
    • Validates cleans up the active listener and leaves 0 live listeners.
    • Validates account change propagation to registered handlers.

Verification

  • bun test v1.4.0 (34cbb9a40): 4/4 unit tests passed 100% green.

@Kingsman-99

Copy link
Copy Markdown
Contributor

Closing this PR — it was opened against an issue that wasn't assigned to you. To avoid duplicate work, please wait for an issue to be assigned before submitting a PR for it. Feel free to comment on the issue to request assignment.

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.

XBullAdapter leaks an account-change listener on every reconnect, and disconnect() removes only the last one

2 participants