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

Make sure GetPeers response always fits within a single UDP datagram #3

Open
madadam opened this issue Nov 11, 2021 · 0 comments
Open

Comments

@madadam
Copy link
Collaborator

madadam commented Nov 11, 2021

The spec says:

A node obeying this specification must not send UDP datagrams with a payload larger than 1024 octets,

We need to calculate the maximum number of values we can put into the response so the total message size is <= 1024 bytes. Call this number N. If we have more than N peers, we should take only N of them, but we should randomize which N to pick.

Note that N depend on whether we are sending ipv4 or ipv6 contacts and also on the number of ipv4 and/or ipv6 nodes we include in the message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant