-
Notifications
You must be signed in to change notification settings - Fork 808
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
Expose plugin system, move walletdb to a plugin #156
Conversation
This looks awesome! The idea of plugins is great. I saw in #98 you were considering the name modules, any reason for sticking with plugins? I personally kind of prefer 'modules'. walletdb at least feels like more of a module than a plugin. But that's a semantic thing. For enabling the plugin with |
Yeah, I don't really like the plugin name either, but
I like require better since you're not necessarily loading anything (you're requiring something as a dependency). |
@mcelrath, do you think this would impact usage of the SPVNode? |
Merged in, but I'm going to keep |
There are a lot of changes here...I'll evaluate it. We're using the walletdb to hold SPV transactions, but not a wallet (bcoin has no privkeys and no coins). So if that interface has changed it will certainly affect us. |
@mcelrath, yeah, lots of changes, but it had to be done. The wallet doesn't belong on the full node. That being said, I may keep walletdb on the SPVNode object just like before (since the spvnode is basically useless without the wallet). |
Finally exposing a new plugin system similar to the one described in #98.
A few things needed to happen before this was possible:
config
object on the Node object so plugins can access configuration options.These three things allowed the wallet HTTP routes and RPC calls to be separated into their own modules:
As far as the Node object goes, a
plugins
option has been added. e.g.require
must be passed in from the outside. This avoids bcoin having to directly make conditional requires.A simple plugin might look like:
I'm now wondering if we should have the wallet disabled by default (requiring bcoin to be run with
bcoin --plugins walletdb
if a user wants a wallet). The eventual goal is to move the wallet code out of this repository completely. The next task would be to have the wallet run as its own server (very close to happening now).Thoughts, comments, criticism are all appreciated.