-
Notifications
You must be signed in to change notification settings - Fork 411
Handle query_channel_range gossip queries #828
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
Handle query_channel_range gossip queries #828
Conversation
Creates a MessageSendEvent for sending a reply_channel_range message. This event will be fired when handling inbound query_channel_range messages in the NetGraphMessageHandler.
Overflow safe calculation of the ending block number for a query. Can be used when processing the query.
Util converts parts into u64 SCID Util extracts block height from u64 SCID Both will be used when processing gossip_query messages.
Initial implementation of handling query_channel_range messages in NetGraphMsgHandler. Enqueues a sequence of reply message in the pending message events buffer.
c2d0aec
to
44ba52c
Compare
Codecov Report
@@ Coverage Diff @@
## main #828 +/- ##
==========================================
+ Coverage 90.97% 92.35% +1.38%
==========================================
Files 48 51 +3
Lines 26452 32827 +6375
==========================================
+ Hits 24064 30318 +6254
- Misses 2388 2509 +121
Continue to review full report at Codecov.
|
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.
Some pretty trivial nits, but overall looks good. Will get a second reviewer this week.
This implementation enqueues each reply message as an event. Right now, at most this will only generate a few events per query due to the graph size. In the future it could generate a large number of events if the graph is large. I'm considering switching to a polling model like the init_sync code in do_attempt_write_data to be more aware of the write buffer. Wanted opinions before I go down that path though.
Hmm, right, ~5 messages for ~32KB is definitely not worth doing that for, but we will need it to respond to ReplyChannelRange
messages, which could be a lot of additional messages and we can't block channel messages while sending them. For that we definitely need to pull the InitSyncTracker struct out into network_graph.rs
and make it an associated type for the RoutingMessageHandler
trait. I leave it up to you if you want to take that complexity here and also apply it to this code or not.
Modifies scid_from_parts to use u64 inputs allowing untruncated validation. Adds public constants for limits.
Refactors validation and short_channel_id construction to use the new scid_from_parts function.
Refactor to use an enumerator in NetGraphMsgHandler::handle_query_channel_range
Thanks for the review, I updated with nit fixes!
Do you mean reply to |
Clarifies u32 max value used as the default.
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.
Overall sounds good, mostly minor comments. I did exercise the test coverage, can't find holes.
This implementation enqueues each reply message as an event. Right now, at most this will only generate a few events per query due to the graph size. In the future it could generate a large number of events if the graph is large. I'm considering switching to a polling model like the init_sync code in do_attempt_write_data to be more aware of the write buffer. Wanted opinions before I go down that path though.
What are you thinking of more exactly ? I would say the rational for the direction is justified, though can't identify the init_sync
code you're mentioning.
Yes, and, ok, sounds good. Can you add a comment noting the amount of memory that can be used in these messages and at what point we should change the logic to avoid it? |
@ariard thanks for the review! Will clean up those points.
I was refer to |
Modifies NetGraphMsgHandler::handle_query_channel_range to use a constant max value in replies. Modifies tests to generate 8000 channels instead of making this value configurable.
40ef08d
to
81ec069
Compare
Cleans up NetGraphMsgHandler::handle_query_channel_range
Modify NetGraphMsgHandler::handle_query_channel_range to always use first_blocknum=0 in replies. This is spec compliant after changes to make sequence completion explicity using sync_complete.
81ec069
to
7b842b6
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.
Code Review ACK 7b842b6
Thanks for simplifying sequencing of handle_query_channel_range
. Reading the spec again, this new way to fulfill first_blocknum
/number_of_blocks
is compliant, all good.
Finally back in the saddle on this. This PR implements the
NetGraphMsgHandler
method for processing inboundquery_channel_range
messages. I'm working on another PR to handlequery_short_channel_ids
as well.Notes:
init_sync
code indo_attempt_write_data
to be more aware of the write buffer. Wanted opinions before I go down that path though.first_blocknum
,number_of_blocks
) is still necessary to be spec compliant even though its ugly. I added notes on overflow safety. I'm happy to make that more explicit if that's preferable.