Skip to content

Reset InMempool txs to Inactive before connecting to the node#2051

Merged
ImplOfAnImpl merged 6 commits into
masterfrom
fix/wallet-reset-inmempool-txs
Jul 8, 2026
Merged

Reset InMempool txs to Inactive before connecting to the node#2051
ImplOfAnImpl merged 6 commits into
masterfrom
fix/wallet-reset-inmempool-txs

Conversation

@OBorce

@OBorce OBorce commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

We reset all InMempool transactions back to Inactive on

  1. wallet load,
  2. every time the mempool notifications channel is closed
    so that we can rescan them from the node when we connect back.

@ImplOfAnImpl ImplOfAnImpl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned earlier, mempool can evict transactions - there is a size limit for the entire mempool and an expiration time for each tx. Though at this memoment it's unlikely to happen (the size limit is 300Mb and expiration time 2 weeks), it's better to fix the problem fully from the beginning. At this moment eviction only happens after a new tx has been added to the mempool. So the fix could be that whenever the wallet receives a NewTransaction event, it would obtain all InMempool tx ids from the output cache, check which of them are no longer in mempool and reset their status. (though it's better not to use MempoolRpc::contains_tx for checking and instead introduce an additional method that would operate on a set of ids, to avoid the rpc calls overhead).

Comment thread wallet/src/account/output_cache/tests.rs Outdated
Comment thread wallet/wallet-controller/src/lib.rs Outdated
@OBorce OBorce marked this pull request as draft May 19, 2026 08:34
@ImplOfAnImpl ImplOfAnImpl force-pushed the fix/wallet-reset-inmempool-txs branch 2 times, most recently from 1dafd7c to f06734b Compare July 8, 2026 15:23
@ImplOfAnImpl ImplOfAnImpl changed the base branch from master to ledger_update_repo_ref_and_fix_reconnection July 8, 2026 15:23
@ImplOfAnImpl

Copy link
Copy Markdown
Contributor

As I mentioned earlier, mempool can evict transactions - there is a size limit for the entire mempool and an expiration time for each tx. Though at this memoment it's unlikely to happen (the size limit is 300Mb and expiration time 2 weeks), it's better to fix the problem fully from the beginning. At this moment eviction only happens after a new tx has been added to the mempool. So the fix could be that whenever the wallet receives a NewTransaction event, it would obtain all InMempool tx ids from the output cache, check which of them are no longer in mempool and reset their status. (though it's better not to use MempoolRpc::contains_tx for checking and instead introduce an additional method that would operate on a set of ids, to avoid the rpc calls overhead).

I added a TODO for this

@ImplOfAnImpl ImplOfAnImpl marked this pull request as ready for review July 8, 2026 15:24
@ImplOfAnImpl ImplOfAnImpl requested a review from anyxem as a code owner July 8, 2026 15:24
Base automatically changed from ledger_update_repo_ref_and_fix_reconnection to master July 8, 2026 15:40
@ImplOfAnImpl ImplOfAnImpl force-pushed the fix/wallet-reset-inmempool-txs branch from 03bb838 to ed575b8 Compare July 8, 2026 15:42
@ImplOfAnImpl ImplOfAnImpl merged commit 01abd37 into master Jul 8, 2026
20 checks passed
@ImplOfAnImpl ImplOfAnImpl deleted the fix/wallet-reset-inmempool-txs branch July 8, 2026 18:30
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.

2 participants