I’m stuck on Stage #nd2.
I have loaded the piece that have correct length and hash (the torrent file info), but test says that:
“File size does not match expected file size. Expected: 190404 Actual: 262144”
Here are my logs:
NITROROOT% codecrafters test
Initiating test run...
⚡ This is a turbo test run. https://codecrafters.io/turbo
Running tests. Logs should appear shortly...
[compile] Compiling bittorrent-starter-rust v0.1.0 (/app)
[compile] Finished release [optimized] target(s) in 5.16s
[compile] Compilation successful.
Debug = true
[tester::#ND2] Running tests for Stage #ND2 (Download a piece)
9 /tmp/torrents878677958/itsworking.gif.torrent 9
[your_program] IPS: [("178.62.85.20", "51493"), ("165.232.33.77", "51495"), ("178.62.82.89", "51415")]
[your_program] torrent.info.length: 2549700
[your_program] torrent.info.piece_length: 262144
[your_program] piece_hash: 01cc17bbe60fa5a52f64bd5f5b64d99286d50aa5
[your_program] info piece hashes: ["01cc17bbe60fa5a52f64bd5f5b64d99286d50aa5", "838f703cf7f6f08d1c497ed390df78f90d5f7566", "45bf10974b5816491e30628b78a382ca36c4e05f", "84be4bd855b34bcedc0c6e98f66d3e7c63353d1e", "86427ac94d6e4f21a6d0d6c8b7ffa4c393c3b131", "7c70cd5f44d1ac5505cb855d526ceb0f5f1cd5e3", "3796ab05af1fa874173a0a6c1298625ad47b4fe6", "272a8ff8fc865b053d974a78681414b38077d7b1", "b07128d3a6018062bfe779db96d3a93c05fb81d4", "7affc94f0985b985eb888a36ec92652821a21be4"]
[your_program] to file len: 262144
[your_program] Piece 9 downloaded to /tmp/torrents878677958/piece-9.
[tester::#ND2] File size does not match expected file size. Expected: 190404 Actual: 262144
[tester::#ND2] Test failed
View our article on debugging test failures: https://codecrafters.io/debug