-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Keep reorgs fast for SequenceLocks checks #7187
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
Conversation
|
Since #6312 has gne through a lot of review already, I would prefer that this branch builds on top of that to more easily review the differences. We can always squash things before merging for a cleaner history. |
|
But I think #7184 is a cleaner implementation of BIP 68 on its own. |
|
as said squashes to clean up the history can happen after review. |
9da86bd to
1d1a35f
Compare
|
rebased |
|
I think this PR is too complicated for fixing the perf issue, if NicolasDorier/bitcoin@67646e0...b2a27a7 is correct, it would be simpler to review. Regardless if we use #7184 or not. |
|
@NicolasDorier I agree. Maybe more importantly, all the extra complexity is outside of the consensus critical code. Maybe you should consider opening a PR for your solution? |
|
Is this supposed to fix the performance issues of CNB without touching miner.cpp, or are this just preparations without the actual performance solution? |
|
@jtimon This fixes the performance issues by never introducing them into CNB in the first place. #7184 on its own has performance issues with reorgs. @NicolasDorier You think just the second commit here is significantly more complicated than your final commit in #7190? |
1d1a35f to
5350fdf
Compare
|
squashed a bug fix (wasn't actually skipping the work it was supposed to) |
|
I like the fact you separate CheckLockTime (if you rename IsFinalTx) and CheckSequenceLockTime, but I really don't like the LockPoints structure. I'm still reviewing if commit 2 might not result in mempool finality corruption, I really don't find it obvious. |
|
btw can you rename IsFinalTx to CheckLockTime as you said you wanted to do ? |
|
@NicolasDorier My approach and yours are not that different.
|
|
Ok I'm getting it. Seems like it can work. |
|
@NicolasDorier I left that out on purpose. See #7184. It might need to be added back in but it wasn't really clear to me how that code ever gets hit. I've tried asking about it on IRC a couple of times. But it doesn't seem possible to me to generate a wallet tx which is sequence locked except in the event of a reorg, at which point the tx won't be in your mempool anyway. |
|
Ok, I don't really understand those implication yet. |
|
Will you rename to IsFinalTx to CheckLockTime and CheckSequenceLocks to CheckSequenceLockTime ? |
5350fdf to
9d48b2e
Compare
9d48b2e to
f8b6614
Compare
|
you may optimize even more: Only take the heights which correspond to an input who has a LockSequence for maxInputHeight calculation. |
|
@NicolasDorier that's already done. CalculateSequenceLocks already sets heights for non sequence locked inputs to 0. |
|
Code review ACK (apart from comment nit). Testing... |
|
Tested ACK (hacked up some extra tests to |
|
@sdaftuar Would you mind publishing/PRing those extra tests? Maybe they could be added to this PR? |
|
comment nit addressed |
|
Kicked Travis |
src/txmempool.h
Outdated
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.
I believe it suffices to turn this into a const reference.
|
If I've done something wrong it was by mistake I'm new and trying to learn. Sorry if I messed up |
|
Please explain all my mistakes please as this should help the future |
|
utACK ddb4dab |
What happened exactly? If you have specific questions about development and review process feel free to mail me on [email protected] |
|
ut/code review ACK ddb4dab |
src/txmempool.h
Outdated
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.
Did you consider storing a CBlockIndex* here instead of a uint256? (may be a stupid suggestion, but from what I see the only thing you do is look it back up in mapBlockIndex)
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.
hmm... i feel like we did consider that, but i can't see now why that wouldn't work. maybe it didn't work with some previous iteration. it makes sense to switch to that if we can't see any problems with it.
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.
right, I don't see any problems with it at least: as I see it it'd simplify the code, reduce storage requirement for LockPoints, and makes the same (valid) assumption that a block index entry never goes away
|
Concept ACK, started reviewing more deeply. |
|
@laanwj ok done. If you think this has sufficient review I can squash. |
Obtain LockPoints to store in CTxMemPoolEntry and during a reorg, evaluate whether they are still valid and if not, recalculate them.
|
Squashed from e6cc06b which contained the switch to CBlockIndex*'s |
|
utACK 982670c |
982670c Add LockPoints (Alex Morcos)
|
@laanwj this PR has been backported in 7543. |
|
Removed 'needs backport' label per previous comment |
Builds on #7184
Adds a commit to keep the mempool consistent with respect to sequence locked txs in the event of a reorg