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

Check that we ended up at the wanted sha1 #32

Closed
cjb opened this issue Jun 1, 2015 · 1 comment
Closed

Check that we ended up at the wanted sha1 #32

cjb opened this issue Jun 1, 2015 · 1 comment

Comments

@cjb
Copy link
Owner

cjb commented Jun 1, 2015

The reason we're okay with pulling objects from anonymous peers is that we have a trusted hash to compare against -- apply the object, see where we ended up. If it's the wrong sha1, we could retry from other peers until we get the right one, but for now let's just leave a big red noticeable error and exit.

@cjb
Copy link
Owner Author

cjb commented Jun 1, 2015

Ah, this PR isn't necessary. Git already performs the check for us. Just tested by sending the wrong packfile to a client:

 λ git clone gittorrent://github.com/cjb/gittorrent
Cloning into 'gittorrent'...

Okay, we want to get: 3c29320fd5c9e9d4ea2b4936fead9046b6a96534

Adding swarm peer: 192.34.86.36:30000

Downloading git pack with infohash: b3daa83096a71524fd67367b10b6a33e08d6f69d

Receiving objects: 100% (158/158), 25.21 KiB | 0 bytes/s, done.
Resolving deltas: 100% (85/85), done.
Checking connectivity... fatal: bad object 3c29320fd5c9e9d4ea2b4936fead9046b6a96534
fatal: remote did not send all necessary objects
 λ 

Closing the PR.

@cjb cjb closed this as completed Jun 1, 2015
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

Successfully merging a pull request may close this issue.

1 participant