Skip to content
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

Made sync params configurable #1124

Merged
merged 4 commits into from
Sep 5, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eclair-core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ eclair {
sync {
request-node-announcements = true // if true we will ask for node announcements when we receive channel ids that we don't know
encoding-type = zlib // encoding for short_channel_ids and timestamps in query channel sync messages; other possible value is "uncompressed"
channel-range-chunk-size = 3500 // how many short channel ids we are going to answer at once; we can theoretically fit 4091 uncompressed channel ids in a single lightning message (max size 65 Kb)
short-id-window = 100 // how many channels are we going to request at once
channel-range-chunk-size = 2500 // do not change this unless you know what you are doing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not also keep the previous message? I think it was useful

pm47 marked this conversation as resolved.
Show resolved Hide resolved
pm47 marked this conversation as resolved.
Show resolved Hide resolved
channel-query-chunk-size = 100 // do not change this unless you know what you are doing
pm47 marked this conversation as resolved.
Show resolved Hide resolved
}

// the values below will be used to perform route searching
Expand Down
7 changes: 2 additions & 5 deletions eclair-core/src/main/scala/fr/acinq/eclair/NodeParams.scala
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,6 @@ object NodeParams {
case "zlib" => EncodingType.COMPRESSED_ZLIB
}

val channelRangeChunkSize = config.getInt("router.sync.channel-range-chunk-size")
require(channelRangeChunkSize <= 4000, "channel-range-chunk-size must be below 4000")

NodeParams(
keyManager = keyManager,
alias = nodeAlias,
Expand Down Expand Up @@ -249,8 +246,8 @@ object NodeParams {
randomizeRouteSelection = config.getBoolean("router.randomize-route-selection"),
requestNodeAnnouncements = config.getBoolean("router.sync.request-node-announcements"),
encodingType = routerSyncEncodingType,
channelRangeChunkSize = channelRangeChunkSize,
shortIdWindow = config.getInt("router.sync.short-id-window"),
channelRangeChunkSize = config.getInt("router.sync.channel-range-chunk-size"),
t-bast marked this conversation as resolved.
Show resolved Hide resolved
channelQueryChunkSize = config.getInt("router.sync.channel-query-chunk-size"),
searchMaxRouteLength = config.getInt("router.path-finding.max-route-length"),
searchMaxCltv = CltvExpiryDelta(config.getInt("router.path-finding.max-cltv")),
searchMaxFeeBase = Satoshi(config.getLong("router.path-finding.fee-threshold-sat")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ case class RouterConf(randomizeRouteSelection: Boolean,
requestNodeAnnouncements: Boolean,
encodingType: EncodingType,
channelRangeChunkSize: Int,
shortIdWindow: Int,
channelQueryChunkSize: Int,
searchMaxFeeBase: Satoshi,
searchMaxFeePct: Double,
searchMaxRouteLength: Int,
Expand Down Expand Up @@ -589,7 +589,7 @@ class Router(val nodeParams: NodeParams, watcher: ActorRef, initialized: Option[
log.info(s"received reply_channel_range with {} channels, we're missing {} channel announcements and {} updates, format={}", shortChannelIds.array.size, channelCount, updatesCount, shortChannelIds.encoding)
// we update our sync data to this node (there may be multiple channel range responses and we can only query one set of ids at a time)
val replies = shortChannelIdAndFlags
.grouped(nodeParams.routerConf.shortIdWindow)
.grouped(nodeParams.routerConf.channelQueryChunkSize)
.map(chunk => QueryShortChannelIds(chainHash,
shortChannelIds = EncodedShortChannelIds(shortChannelIds.encoding, chunk.map(_.shortChannelId)),
if (routingMessage.timestamps_opt.isDefined || routingMessage.checksums_opt.isDefined)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ object TestConstants {
requestNodeAnnouncements = true,
encodingType = EncodingType.COMPRESSED_ZLIB,
channelRangeChunkSize = 20,
shortIdWindow = 5,
channelQueryChunkSize = 5,
searchMaxFeeBase = 21 sat,
searchMaxFeePct = 0.03,
searchMaxCltv = CltvExpiryDelta(2016),
Expand Down Expand Up @@ -185,7 +185,7 @@ object TestConstants {
requestNodeAnnouncements = true,
encodingType = EncodingType.UNCOMPRESSED,
channelRangeChunkSize = 20,
shortIdWindow = 5,
channelQueryChunkSize = 5,
searchMaxFeeBase = 21 sat,
searchMaxFeePct = 0.03,
searchMaxCltv = CltvExpiryDelta(2016),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ class RoutingSyncSpec extends TestKit(ActorSystem("test")) with FunSuiteLike {
val QueryChannelRange(chainHash, firstBlockNum, numberOfBlocks, _) = sender.expectMsgType[QueryChannelRange]
sender.expectMsgType[GossipTimestampFilter]

val block1 = ReplyChannelRange(chainHash, firstBlockNum, numberOfBlocks, 1, EncodedShortChannelIds(EncodingType.UNCOMPRESSED, fakeRoutingInfo.take(params.routerConf.shortIdWindow).keys.toList), None, None)
val block1 = ReplyChannelRange(chainHash, firstBlockNum, numberOfBlocks, 1, EncodedShortChannelIds(EncodingType.UNCOMPRESSED, fakeRoutingInfo.take(params.routerConf.channelQueryChunkSize).keys.toList), None, None)

// send first block
sender.send(router, PeerRoutingMessage(transport.ref, remoteNodeId, block1))
Expand Down