-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[6/7]: discovery: sync gossip using block heights & ranges #8255
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
base: elle-g175-thread-chan-update
Are you sure you want to change the base?
[6/7]: discovery: sync gossip using block heights & ranges #8255
Conversation
5d2291b
to
0af66d8
Compare
96afa6e
to
5c11c93
Compare
0af66d8
to
5246374
Compare
Important Review skippedAuto reviews are limited to specific labels. Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
So that a start block and end block can also be passed in.
5246374
to
d95e2f3
Compare
5c11c93
to
e1b873e
Compare
startBlock tlv.RecordT[tlv.TlvType2, uint32] | ||
endBlock tlv.RecordT[tlv.TlvType4, uint32] | ||
) | ||
startBlock = g.remoteUpdateHorizon.FirstBlockHeight.UnwrapOr(startBlock) |
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.
Perhaps we just want to make an UnwrapOrV
? Similar to WhenSomeV
it will call Val
for you, so then we cna just pass in the two timestamps above.
We may also want consider making a type alias for tlv.RecordT[tlv.TlvType2, uint32]
, so then it can just be lnwire.ChanUpdStartBlock
(or something like that).
tx, edges, edgeIndex, nodes, edgeUpdateIndexBucket, | ||
startTimeBytes[:], endTimeBytes[:], | ||
func(key []byte) []byte { | ||
return key[8:] |
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.
Let's throw up these magic numbers into top level constants.
return err | ||
} | ||
|
||
var startBlockBytes, endBlockBytes [4 + 8]byte |
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.
Same here re the key lengths.
@@ -147,8 +147,8 @@ type DB interface { | |||
// ChanUpdatesInHorizon returns all the known channel edges which have | |||
// at least one edge that has an update timestamp within the specified | |||
// horizon. | |||
ChanUpdatesInHorizon(startTime, endTime time.Time) ( | |||
[]channeldb.ChannelEdge, error) | |||
ChanUpdatesInHorizon(startTime, endTime time.Time, startBlock, |
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.
Is the expectation that both the timestamp and block are always set now? If only one of them is expecting, we may wan tto rol that into a new struct to better convey that with types.
@@ -690,12 +694,23 @@ func (g *GossipSyncer) replyHandler() { | |||
// sendGossipTimestampRange constructs and sets a GossipTimestampRange for the | |||
// syncer and sends it to the remote peer. | |||
func (g *GossipSyncer) sendGossipTimestampRange(firstTimestamp time.Time, | |||
timestampRange uint32) error { | |||
timestampRange uint32, firstBlock, blockRange *uint32) error { |
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.
Opt instead of the pointer?
This is part of the Gossip 1.75 epic.
Depends on #8164 so only the last 4 commits are new
In this PR, we make use of the new StartHeight and BlockRange fields in the
GossipTimestampRange
message.