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

peerstore.AddAddrs(..., ttl) is very difficult to use correctly #3218

Open
sukunrt opened this issue Feb 28, 2025 · 0 comments
Open

peerstore.AddAddrs(..., ttl) is very difficult to use correctly #3218

sukunrt opened this issue Feb 28, 2025 · 0 comments

Comments

@sukunrt
Copy link
Member

sukunrt commented Feb 28, 2025

When users do AddAddrs(..., TTL) they want the TTL to count after the peer disconnects, not immediately after setting the TTL.

What happens instead is that the TTL is almost always discarded because identify has set a much higher TTL for the same addresses. This TTL ofcourse is just a marker value which means remove these on disconnection. So the addresses are actually removed well before TTL if the peer disconnects soon after the call to AddAddrs.

The suggested solution for users is to use their own address book and not share the libp2p host's address book. This helps in most of the cases, but the majority of the users would still prefer expiring addresses TTL after disconnection not from the time of calling.

Note: This is similar to what @MarcoPolo suggested here: #2355 (comment)
I'm proposing that we do this for addresses as well, not just protocols.

For the most recent misuse of the API: libp2p/go-libp2p-kad-dht#1053 (comment)

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