-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix mempool transactions disappearing if a parent tx is confirmed. #539
Conversation
I much rather prefer RemoveTransaction get the API change like removeTransaction, and get rid of RemoveConfirmedTransaction. The update all callers of RemoveTransaction() to specify whether they want to remove depending or not. |
The concept is correct, but I agree with @dajohi regarding the implementation. |
2d6a2e9
to
c954819
Compare
Reviewed 2 of 2 files at r1, 2 of 2 files at r2. Comments from the review on Reviewable.io |
OK |
1 similar comment
OK |
Not sure depending is the best name for those transactions, because depending could also refer to parent txs. Perhaps removeChildren? |
I suppose the name could be confusing. Given the comment accurately describes it I didn't worry about it, but perhaps |
+1 for removeRedeemers |
c954819
to
3dd6c39
Compare
Changed. |
Reviewed 1 of 1 files at r3. Comments from the review on Reviewable.io |
ok |
// pool also removes any transactions which depend on it, | ||
// recursively. | ||
// no longer an orphan. Transactions which depend on a confirmed | ||
// transaction are NOT removed recursively because they are still valid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While here, can we make the above comment limited to 80 chars?
3dd6c39
to
912a8d8
Compare
Review status: 1 of 2 files reviewed at latest revision, 1 unresolved discussion. blockmanager.go, line 1219 [r3] (raw file): Comments from the review on Reviewable.io |
Reviewed 1 of 1 files at r4. Comments from the review on Reviewable.io |
OK |
There's a bug in the logic that processes new blocks that causes txs to be unnecessarily dropped from mempool.
Basically:
There are two txs A and B in mempool. Tx B uses an output from A.
A new block is received that contains A but not B.
RemoveTransaction(A) will be called on the mempool, which will recursively remove B. However, B should not be removed because it's not orphan, its parent is now on the blockchain.
This fixes the bug by not recursively removing depending transactions when processing blocks.