1
0
mirror of https://github.com/ACINQ/eclair.git synced 2024-11-20 02:27:32 +01:00
eclair/eclair-core
Fabrice Drouin 90a1ee6abc
Fix how we split channel ids in channel queries (#1274)
* Add test to check that we split short channel ids correctly

reply_channel_range messages should not overlap i.e different replies should not contain
channel ids that have the same block height.

The test in this commit fails, because our 'split' function needs to be updated.

* Channel Queries: make sure that our replies match the request range (fixes #1269)

Even though it's not completely explicit in the specs, we should make sure that
the [firstBlock, numBlock] range that we cover in our replies is not computed
from the ids that we actually have but instead matches the [firstBlock, numBlock] range
that was requested.

* Make sure that serialised replies stay below the 65Kb limit

We prune short channel id chunks to make sure that serialised replies stay below the 65 Kb limit.
The pruning algo is very simple: for each chunk we randomly keep the first or last 3200 ids
Selection is random so peers that re-connect will eventually receive all channel info.
The limit of 3200 was chosen for the worst case where replies are not compressed and include timestamps and checksum.
It is a fairly conservative boundary, the highest number of public channels in a single block so far is <300, and
there 3200 is roughly the currently observed number of transactions in a "full" block.

* Set default ids chunk size to 1500

Have smaller chunks (smaller than 3200 / 2) reduces the probability of merging 2 chunks and having to prune the result because the encoded reply would be over 65K.

* Smarter algo for enforcing max chunk size policy

Instead of keeping either the first or last items, we use a random offset. This way peers will eventually receive info about all channels even if chunks are much larger than the max chunk size and are pruned.
2020-01-14 14:28:51 +01:00
..
src Fix how we split channel ids in channel queries (#1274) 2020-01-14 14:28:51 +01:00
eclair-cli Typed amounts (#1088) 2019-08-07 17:37:38 +02:00
pom.xml Release 0.3.2 (#1177) 2019-10-15 19:26:42 +02:00