Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add support for zero-conf and scid-alias #2224
Add support for zero-conf and scid-alias #2224
Changes from 43 commits
bbd0b34
244d6dd
838559e
1e88cb6
54b91ea
7ae4b1a
2be5699
dd23c14
93bbb8c
c965f97
a8940d3
cac1d22
aab4f76
32a0d5a
3aa0560
774432e
93a3d7e
2cf1338
7a5a3df
a9e572f
ecbcb58
c1fabe7
4d25535
58de78c
ca67ffc
19d2943
9743113
391c8a2
e26420b
a4c3ab4
14837e3
18a3e28
7e41af2
1523c41
0a5a239
9be02bf
572136d
a426e1b
34cc748
896c4e5
31799b7
0db76d4
957f014
db232e1
c20f672
305124f
79ef2c3
189d101
b5f137f
dcc5236
02bfd0f
a1ebd76
ac60f87
4f6385b
04fc0e6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 generating an alias only happens at channel creation, we can afford doing something "costly". For example this could be an
AtomicLong
that we initialize at startup by checking all currently assignedlocalAlias
, and then we do anaddAndGet
with a random increment when we need to generate a new alias.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.
I don't think we really need a counter, wouldn't a
randomLong()
in the range that cannot be used by normal channels be enough?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 cannot afford a duplicate here though and the space isn't that big. We should expect a collision for 5 billion attempts on 64 bits and only 80k attempts for 32 bits right? https://en.wikipedia.org/wiki/Birthday_attack
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.
It's true, the space isn't that big, but I'm afraid there may be privacy issues with generating those incrementally...I'll check what other implementations do
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.
I did some maths to confirm this, let me know if my calculations look correct:
This is indeed not great! But using a counter that we increment leaks information about the approximate creation time of the channel, which could let an attacker find the channel outpoint on-chain...so I believe that what we should do instead is:
It means we'll probably need to send a message to the router to obtain a new alias, the router is where we can guarantee uniqueness.
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.
Using a blockheight 0 for unconfirmed transactions is a bit hacky.