Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor mempool.rs to prevent from returning conflicting transaction during RBF #79

Closed
romanz opened this issue Oct 21, 2018 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@romanz
Copy link
Owner

romanz commented Oct 21, 2018

Currently, there seems to be a race when updating the mempool with RBF transactions - causing a concurrent API to return conflicting mempool transactions (i.e. spending the same inputs).

Also we need to add tests and simplify mempool.rs module.

@romanz romanz self-assigned this Oct 21, 2018
@romanz romanz added the bug Something isn't working label Oct 21, 2018
@pedr0-fr
Copy link

pedr0-fr commented Feb 8, 2020

Has this been solved? Maybe it could be normal behavior to show old RBF transactions that were replaced and flag the one that is currently in the mempool.

@romanz
Copy link
Owner Author

romanz commented Feb 9, 2020

Has this been solved?

Not yet :)

Maybe it could be normal behavior to show old RBF transactions that were replaced and flag the one that is currently in the mempool.

Not sure - I prefer to keep the complexity at minimum...

@romanz
Copy link
Owner Author

romanz commented Oct 3, 2021

Latest release's (0.9.0) mempool should always contain a subset of the bitcoind mempool.
In case of a RBF, the missing transaction will not be added to electrs mempool:

electrs/src/mempool.rs

Lines 102 to 113 in 239e465

let entries: Vec<_> = to_add
.par_iter()
.filter_map(|txid| {
match (
daemon.get_transaction(txid, None),
daemon.get_mempool_entry(txid),
) {
(Ok(tx), Ok(entry)) => Some((txid, tx, entry)),
_ => None,
}
})
.collect();

@romanz romanz closed this as completed Oct 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants