Skip to content

use sequence zmq event instead of hashblock#199

Open
RuslanProgrammer wants to merge 1 commit intoBlockstream:new-indexfrom
RuslanProgrammer:zmq-subscribtion-fix
Open

use sequence zmq event instead of hashblock#199
RuslanProgrammer wants to merge 1 commit intoBlockstream:new-indexfrom
RuslanProgrammer:zmq-subscribtion-fix

Conversation

@RuslanProgrammer
Copy link
Copy Markdown

@RuslanProgrammer RuslanProgrammer commented Mar 30, 2026

Fixes: #198

We update the mempool every five seconds. This PR changes the trigger for the index, enabling us to reflect changes to the mempool more precisely.

This PR is open to choosing another subscription type and filtering the specific sequence event.

@nitramiz nitramiz requested a review from shesek March 30, 2026 16:53
@Randy808
Copy link
Copy Markdown
Collaborator

The zmq_event_receive is currently only consumed by the Waiter, signal, and is really only used in the wait method when the accept_block_notification is true. This only happens when wait is invoked in the main loop in electrs.rs which controls mempool updates like you noted in your description.

One issue I see with this approach is the overhead from the increased number of Mempool::update calls. The hashblock notification isn't being used as a way to detect if a transaction hash was added to the mempool, it's a way to communicate to the main loop that we need to remove confirmed txs from the mempool. Whenever it's called, we get all the txids from the node's mempool, remove the txids in our mempool that are no longer present, and make additional calls to retrieve the transactions we don't have. To avoid updates from being invoked for every tx, I'd suggest filtering for just block events.

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.

Long regtest chain synchronization

2 participants