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

Suggestion: use async library #3

Open
askmike opened this issue Jan 18, 2014 · 2 comments
Open

Suggestion: use async library #3

askmike opened this issue Jan 18, 2014 · 2 comments

Comments

@askmike
Copy link

askmike commented Jan 18, 2014

First off: awesome project!

I couldn't help but notice that some functions have a lot of nested callbacks. Maybe it would be an idea to abstract the nesting out via an async library like async. This way you could separate the logic more and use optimizations like parallelizing batches of queries to bitcoind.

@chjj
Copy link
Owner

chjj commented Feb 21, 2014

I was going to write a really long reply to this a while ago, but the short answer is: I want to use as few dependencies as possible. When people see a bitcoin wallet (especially a brand new one like termcoin), they want to know their coins are safe. The termcoin code is very easy to skim through, and it only has one dependency (blessed, which has 0 dependencies). This kind of discussion will inevitably bring up the whole "trusting trust" thing (that it's impossible to trust any code you did not physically write, etc.), but I think it's probably better to live pragmatically in terms of security, and try to stay secure regardless. So, I'm going to try to keep termcoin as "small" as possible.

As for async itself, it's a great library, but I find it easy enough to write my own async control flow functions (serial and parallel loop functions are, what, maybe 3-4 lines each).

However, you're definitely right about parallelizing stuff like getProgress. I will do that, and should have done it from the beginning. embarrassed

If I really find myself in a rut with regards to async stuff, I'll consider using async. I'll leave this open until I parallelize the functions that need to be.

@chjj
Copy link
Owner

chjj commented Feb 21, 2014

Also, thanks for the kind words. Glad you like it. :)

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

2 participants