-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Remove unnecessary calls to CheckFinalTx #9141
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
|
utACK 1484993f691b0913d03154e2fdd0687736c65052 |
src/wallet/wallet.cpp
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.
If fOnlyConfirmed is false, IsTrusted() is not executed at all. Is this OK?
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.
Yes. Your right, was deluded by the OR further down.
I just removed that part.
1484993 to
4512550
Compare
|
ACK 4512550 |
|
When I was adding the logic for sequence locks we decided it was not worth calculating those for wallet txs, primarily because it was near impossible to have a non-final transaction in your wallet (since you would never have accepted it to your mempool). Perhaps out of scope for this PR, but I think we should consider whether we want to support any notion of finality in the wallet at all. These existing CheckFinalTx checks are cheaper but still contribute to complication. Maybe we can just remove them all? Or if we do want to support them, then maybe there is an efficient and general way we can support finality checks for both types of locks. Such as caching the time/height that the tx will be final and in the case of sequence locks, the hash that needs to remain on the main chain for that calculation to still be valid. |
|
Code review ACK 4512550 |
This is true at the moment. Although non-final handling may make sense when the GUI, some day, allows producing transactions that are not final yet. But maybe they could just be flagged some way to keep them from being considered for balance computation until they're actually on the network. |
4512550 Remove unnecessary calls to CheckFinalTx (Jonas Schnelli)
4512550 Remove unnecessary calls to CheckFinalTx (Jonas Schnelli)
4512550 Remove unnecessary calls to CheckFinalTx (Jonas Schnelli)
4512550 Remove unnecessary calls to CheckFinalTx (Jonas Schnelli)
Tiny optimization.
CheckFinalTx()gets always called inCWalletTx::IsTrusted().Calling it together with
IsTrusted()result in calling it twice.CheckFinalTx()get's executed undercs_main(where it calls stuff like tipsGetMedianTimePast(), `GetAdjustedTime().