-
Notifications
You must be signed in to change notification settings - Fork 48
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
Removed note details from sync responses #462
Conversation
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, left a couple of suggestions
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.
Looks good! Thank you! I left one potential improvement suggestion inline.
let tip = select_block_header_by_block_num(conn, None)? | ||
.ok_or(NoteSyncError::EmptyBlockHeadersTable)?; |
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.
Since we know the latest block number in the state
- we may be able to pass chain_tip_num
into this function and potentially avoid this database query (i.e., we can always do just 1 query here instead of sometimes doing 2 queries and sometimes 1).
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.
We don't store latest block number in the State
in-memory by now or I can't find a place you mean. Should I update our in-memory state in order to save the current block number?
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.
We do have latest_block_num() function on the State
. Let's create an issue for this optimization (could be a "good first issue").
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.
@bobbinth ah, thank you, I forgot about this feature of chain mmr. :)
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.
Resolves #309
Introduced
NoteSyncRecord
domain type which omits note details unnecessary for state synchronizations. Refactored code, removed excessive function (select_notes_since_block_by_tag_and_sender
can work asselect_notes_since_block_by_tag
if we provide empty sender list).