-
Notifications
You must be signed in to change notification settings - Fork 38.7k
wallet: cleanup cached amount and input mine check code #25543
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
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
src/wallet/test/wallet_tests.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.
nit
| BOOST_CHECK_EQUAL(CachedTxGetImmatureCredit(wallet, wtx, ISMINE_SPENDABLE), 50*COIN); | |
| BOOST_CHECK_EQUAL(CachedTxGetImmatureCredit(wallet, wtx, ISMINE_SPENDABLE), 50 * COIN); |
aureleoules
left a comment
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.
ACK ba2fa8302dc3816d5b9584907135f91789846d65.
Looks better!
I checked that the refactor does not change the behavior of the code.
theStack
left a comment
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.
Code-review ACK ba2fa8302dc3816d5b9584907135f91789846d65
Nice refactoring!
Instead of duplicate the exact same code twice.
ba2fa83 to
47ea70f
Compare
|
per feedback, have inlined |
theStack
left a comment
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.
re-ACK 47ea70f
|
hey @jonatack @aureleoules, friendly ping here. |
|
re-ACK 47ea70f |
|
ACK 47ea70f |
…ck code 47ea70f wallet: clean AllInputsMine code, use InputIsMine internally (furszy) bf310b0 wallet: clean InputIsMine code, use GetWalletTx (furszy) 0cb1772 wallet: unify CachedTxGetImmatureCredit and CachedTxGetImmatureWatchOnlyCredit (furszy) 04c6423 wallet: remove always true 'fUseCache' arg from CachedTxGetAvailableCredit (furszy) 4f0ca9b wallet: remove always false 'recalculate' arg from GetCachableAmount (furszy) 47b1012 wallet: remove always true 'fUseCache' from CachedTxGetImmatureWatchOnlyCredit (furszy) da8f62d wallet: remove always true 'fUseCache' from CachedTxGetImmatureCredit (furszy) Pull request description: Another wallet's code garbage collector work. Part of the `mapWallet` encapsulation goal. Focused on the following points: 1) Remove always true `fUseCache` argument from `CachedTxGetImmatureCredit`, `CachedTxGetImmatureWatchOnly` and `CachedTxGetAvailableCredit`. 2) Remove always false `recalculate` argument from `GetCachableAmount`. 3) Merge `CachedTxGetImmatureCredit` and `CachedTxGetImmatureWatchOnlyCredit` as they do share the exact same code. 4) Clean `InputIsMine` method; use `GetWalletTx` instead of access the wallet's map directly. 5) Clean `AllInputsMine` method; use `InputIsMine` instead of duplicate the exact same code internally. ACKs for top commit: aureleoules: re-ACK 47ea70f achow101: ACK 47ea70f theStack: re-ACK 47ea70f Tree-SHA512: e9b64b57de7be6165c5e5552e28cd8a03d4736b0a3707d29d129e3a0a3db6a855c2abf47a24917236060835a297b564a97b66d4c8b178d6bdafb93a12a7c0b40
Another wallet's code garbage collector work. Part of the
mapWalletencapsulation goal.Focused on the following points:
fUseCacheargument fromCachedTxGetImmatureCredit,CachedTxGetImmatureWatchOnlyandCachedTxGetAvailableCredit.recalculateargument fromGetCachableAmount.CachedTxGetImmatureCreditandCachedTxGetImmatureWatchOnlyCreditas they do share the exact same code.InputIsMinemethod; useGetWalletTxinstead of access the wallet's map directly.AllInputsMinemethod; useInputIsMineinstead of duplicate the exact same code internally.