-
-
Notifications
You must be signed in to change notification settings - Fork 354
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
Wallet scan optimisation #1474
Wallet scan optimisation #1474
Conversation
WalkthroughThe recent updates improve the wallet recovery process by allowing users to specify their wallet's birth date through the user interface. New UI components were added to the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI
participant Wallet
User->>UI: Selects "Enable Date Selection"
UI->>UI: Enable date input field
User->>UI: Inputs wallet birth date
UI->>Wallet: Passes date for recovery
Wallet->>Wallet: Retrieves block by date
Wallet->>UI: Displays recovery information
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 2
Outside diff range, codebase verification and nitpick comments (1)
src/wallet/wallet.cpp (1)
2374-2387
: Document the rationale behind subtracting 200 from the block height.The logic of subtracting 200 from the block height should be documented to explain its purpose.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (7)
- src/qt/forms/notifymnemonic.ui (1 hunks)
- src/qt/forms/recover.ui (3 hunks)
- src/qt/notifymnemonic.cpp (3 hunks)
- src/qt/recover.cpp (5 hunks)
- src/qt/recover.h (1 hunks)
- src/wallet/wallet.cpp (2 hunks)
- src/wallet/wallet.h (1 hunks)
Additional comments not posted (13)
src/qt/recover.h (1)
25-25
: LGTM! The new method declaration is consistent with the class design.The method
updateDateInputState
is correctly declared as a private slot, aligning with the Qt framework's signal-slot mechanism.src/qt/notifymnemonic.cpp (2)
40-42
: LGTM! The new function implementation is correct.The function
getCurrentDate
correctly retrieves the current date formatted as "dd-MM-yyyy".
52-52
: LGTM! The changes in thenotify
method enhance the user interface.The wallet creation date is correctly displayed using the
getCurrentDate
function.src/qt/recover.cpp (4)
63-68
: LGTM! The new method implementation is correct.The method
updateDateInputState
correctly enables or disables thedateInput
field based on the checkbox state and sets a minimum date if enabled.
52-54
: LGTM! The changes in thesetCreateNew
method are correct.The
dateInput
field is correctly disabled and cleared when creating a new recovery instance.
79-81
: LGTM! The changes in theon_recoverExisting_clicked
method are correct.The
dateInput
field is correctly enabled based on the state of theenableDateSelection
checkbox.
124-128
: LGTM! The changes in theaskRecover
method are correct.The date input is correctly handled based on the state of the
enableDateSelection
checkbox.src/qt/forms/notifymnemonic.ui (2)
113-120
: New QLabel for displaying wallet birth date added.The QLabel
walletBirthDate
is correctly added with properties for displaying text and enabling word wrapping.
125-125
: Text of QLabel updated to include wallet birth date reference.The updated text in
textLabel2
clearly informs users about the importance of the wallet's birth date during restoration and its role in optimizing the wallet scanning process.src/qt/forms/recover.ui (3)
44-44
: Text of QLabel updated to include wallet birth date information.The updated text clearly informs users about the option to choose the wallet birth date for a faster and optimized wallet scan.
138-189
: New vertical layout added for recovery seed phrase and date selection.The vertical layout
verticalLayout2
is correctly added and includes components for inputting the recovery seed phrase and selecting the wallet's birth date.
169-185
: New checkbox and date input field added for wallet birth date selection.The checkbox
enableDateSelection
and date input fielddateInput
are correctly added with properties for enabling date selection and displaying the date in thedd-MM-yyyy
format.src/wallet/wallet.h (1)
932-932
: New methodGetBlockHeightByDate
added toCWallet
class.The method
GetBlockHeightByDate
is correctly added to theCWallet
class. Ensure that the implementation handles edge cases and errors appropriately.
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/qt/recover.cpp (4 hunks)
- src/wallet/wallet.cpp (3 hunks)
Files skipped from review as they are similar to previous changes (2)
- src/qt/recover.cpp
- src/wallet/wallet.cpp
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/qt/recover.cpp (4 hunks)
- src/wallet/wallet.cpp (3 hunks)
Files skipped from review as they are similar to previous changes (2)
- src/qt/recover.cpp
- src/wallet/wallet.cpp
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- src/qt/forms/recover.ui (3 hunks)
- src/qt/recover.cpp (4 hunks)
- src/wallet/wallet.cpp (3 hunks)
- src/wallet/wallet.h (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- src/qt/forms/recover.ui
- src/wallet/wallet.cpp
- src/wallet/wallet.h
Additional comments not posted (5)
src/qt/recover.cpp (5)
35-36
: Initialization ofdateInput
is appropriate.The
dateInput
field is correctly configured with a display format and a minimum date, enhancing user guidance.
53-54
: Disabling and clearingdateInput
is consistent.The changes ensure
dateInput
is not used when creating a new wallet, aligning with the intended functionality.
66-67
: Setting default date and display format fordateInput
.The changes maintain consistency in the UI for new wallet creation.
74-77
: Enabling and configuringdateInput
for recovery is appropriate.These changes align with the goal of allowing users to specify a date during recovery.
120-123
: Logic for adjusting date inaskRecover
is approved, but verify correctness.Subtracting one day from the selected date before using it is a specific logic that should be verified to ensure it aligns with the intended functionality.
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/wallet/wallet.cpp (3 hunks)
Additional comments not posted (3)
src/wallet/wallet.cpp (3)
2374-2386
: LGTM! Verify the logic inGetBlockByDate
.The function correctly iterates through the blockchain to find the appropriate block index based on the given date.
2426-2429
: LGTM!The logging and initialization for rescanning are straightforward and correctly implemented.
2406-2424
: LGTM! Verify edge cases in date handling.The logic for adjusting the starting block index based on the provided date or mnemonic start block looks correct. Ensure edge cases, such as dates before the mnemonic start block, are handled properly.
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.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/wallet/wallet.cpp (3 hunks)
Additional comments not posted (3)
src/wallet/wallet.cpp (3)
2431-2431
: Rescan logging and progress updates look good.The logging and progress updates provide clear information about the rescan process.
2374-2386
: Verify the logic inGetBlockByDate
.The function returns a block index offset by 200 if the block time exceeds the target timestamp. Ensure that this logic aligns with the intended functionality and that the offset is correct.
2411-2429
: Verify handling of the-wcdate
argument.Ensure that the logic correctly handles the
-wcdate
argument and that the block index adjustments are accurate.Verification successful
Verification successful for handling of the
-wcdate
argument.The
-wcdate
argument is correctly used insrc/wallet/wallet.cpp
for retrieving the date and adjusting the block index accordingly. Additionally, it is set insrc/qt/recover.cpp
, indicating its role in date-based operations. The logic appears consistent and appropriate for its intended purpose.
src/wallet/wallet.cpp
: Retrieves-wcdate
usingGetArg
.src/qt/recover.cpp
: Sets-wcdate
usingSoftSetArg
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the handling of the `-wcdate` argument in the wallet scanning logic. # Test: Search for the `-wcdate` argument usage. Expect: Correct handling and logic adjustments. rg --type cpp -A 5 $'-wcdate'Length of output: 433
Script:
#!/bin/bash # Description: Verify the handling of the `-wcdate` argument in the wallet scanning logic. # Test: Search for the `-wcdate` argument usage. Expect: Correct handling and logic adjustments. rg --type cpp -A 5 "'-wcdate'"Length of output: 38
Script:
#!/bin/bash # Description: Verify the handling of the `-wcdate` argument in the wallet scanning logic. # Test: Search for the `-wcdate` argument usage. Expect: Correct handling and logic adjustments. rg --type cpp -A 5 "-wcdate"Length of output: 433
Script:
#!/bin/bash # Description: Verify the handling of the `-wcdate` argument in the wallet scanning logic. # Test: Search for the `-wcdate` argument usage. Expect: Correct handling and logic adjustments. rg --type cpp -- "-wcdate"Length of output: 207
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/wallet/wallet.cpp (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/wallet/wallet.cpp
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/wallet/wallet.cpp (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/wallet/wallet.cpp
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/wallet/wallet.cpp (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/wallet/wallet.cpp
e19e0f6
to
996878d
Compare
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.
LGTM
996878d
to
1622404
Compare
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/wallet/wallet.cpp (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/wallet/wallet.cpp
Аdded functionality that allows users to specify the creation date of their wallet during the recovery process for a more optimal wallet scan. Additionally, when creating a new wallet, the creation date will be displayed so that users can save it for future reference.