[#PK2] Reserved bit in Handshake for Extension Protocol seems to be set incorrectly by CodeCrafters server

I’m stuck on Stage #PK2.

I tried capturing messages being sent back by the codecrafters server in wireshark. I seem to be getting 00 00 00 00 00 00 00 04:

However, testing it out with another magnet link generated with a debian torrent magnet:?xt=urn:btih:7F7RBTXTE2X4X4T3Y426TBKX5BGTHOP6&dn=debian-12.6.0-amd64-netinst.iso&xl=661651456&tr=http%3A%2F%2Fbttracker.debian.org%3A6969%2Fannounce, I get 00 00 00 00 00 10 00 05. The 20th bit from the right is set as expected (no image since I can only upload one image in a post?)

I would expect to get back a message with the 20th bit from the right set, as written in the challenge description 00 00 00 00 00 10 00 00. Is this a bug or expected?

Hi KendrickAng,
Which magnet link are you testing with? Have you tried one of these?

The IP address 165.232.38.164 isn’t one of the peers I’m getting back for our magnet links:

Peer 1: 167.71.143.54:51426
Peer 2: 165.232.35.139:51459
Peer 3: 139.59.184.255:51548

We use different peers between the base stages and extension stages. The peers for base stages won’t send back the extension bit on purpose.

It seems like you’re trying to connect to a peer from our base stages. Let me know if it works with one of the peers I’ve listed above.

Hi @sarp,

Please include it in the documentation, as for legacy projects, this file is not included…

I have lost a few hours trying to set up a local tracker because the very first magnet link provided in Parse magnet link #hw0 does not support magnet.

Similar to what @Caceresenzo mentioned, I used sample.torrent represented as a magnet link in #HW0:

magnet:?xt=urn:btih:d69f91e6b2ae4c542468d1073a71d4ea13879a7f&dn=sample.torrent&tr=http%3A%2F%2Fbittorrent-test-tracker.codecrafters.io%2Fannounce

Perhaps a warning could be included that the provided link doesn’t support magnet links?

In my local, I used the infohash and dn from the one of the tests and it was working fine.

Thanks for bringing this up. sample.torrent was not meant to be used as testing input for magnet links, sorry for the confusion. I’ve updated the course description with a different example that is guaranteed to support extended handshake.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.