Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Remove conflicting transactions from mempool/unconfirmed #68

Closed
LLFourn opened this issue Nov 23, 2022 · 0 comments · Fixed by #74
Closed

Remove conflicting transactions from mempool/unconfirmed #68

LLFourn opened this issue Nov 23, 2022 · 0 comments · Fixed by #74
Assignees

Comments

@LLFourn
Copy link
Owner

LLFourn commented Nov 23, 2022

Right now we allow transactions in SparseChain to double spend if they are in the mempool. Or rather we cannot enforce this within the sparse chain itself since we assume that the txs that are confirmed are from valid blocks and therefore cannot possibly spend each other. The TxGraph however should be able to resolve this for us. In ChainGraph we should be able to enforce this policy on every update (the mempool evictions should go into the ChangeSet) since it also has access to a TxGraph.

I'm not sure what the API should be but you need to be able to:

  1. Get unconfirmed txids from sparse_chain.
  2. For each one, check what conflicts with them. If the conflict is confirmed then it goes into eviction set. Otherwise you tiebreak by fee (perhaps make this configurable).
  3. Create a sparse_chain::ChangeSet of all removals

With chain_graph all of the above should happen automatically behind the scenes when you update so implementing it on ChainGraph might be the place to start to figure out what additional APIs you need on SparseChain and TxGraph (there might not be any).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants