NebulousLabs / Sia

Blockchain-based marketplace for file storage. Project has moved to GitLab: https://gitlab.com/NebulousLabs/Sia
https://sia.tech
MIT License
2.71k stars 442 forks source link

clean up siac renter download #3137

Closed DavidVorick closed 6 years ago

DavidVorick commented 6 years ago

Wasn't happy with the implementation.

I removed the unnecessary 1 second sleep, switched it so that there are no goroutines or channels needed, and I added some extra safety stuff like a timer for a potential infinite loop.

I also added a bunch of TODOs for things that aren't fully done correctly in the code yet.

DavidVorick commented 6 years ago

I changed the number of tries to a try duration.

I kept it returning an error instead of panicking because in practice that error gets fed directly to a user, and I think it's more friendly to have an error like that than to panic on the user.

DavidVorick commented 6 years ago

Ok, this code is now to my satisfaction.

DavidVorick commented 6 years ago

I addressed all comments. I'll add the programming tasks after the PR is merged. Merged with the test fixes on master, this PR should be good to go.