Tbtc Maintainer: Added the maintainer command#3374
Conversation
0fee3de to
74590ac
Compare
|
I'll open a PR with the bitcoin groundwork soon. Please hold off with the merge of this PR until so. |
|
The PR with the Bitcoin toys is ready: #3384 |
74590ac to
9ca81cc
Compare
9ca81cc to
5e40146
Compare
f2f0985 to
dcecec3
Compare
80d5bcb to
87762b8
Compare
f95e7f0 to
8ff5362
Compare
1edb3bf to
ed5ee62
Compare
|
I tried to test it starting the maintainer with |
You need to provide the Alternatively, you can add: to your config file. |
|
I was under the impression that we start all maintainers by default? |
I wanted to leave a TODO for that (once we have more than one maintainer). But now I added launching all maintainer if not option specified in c87ccff. |
the maintainer command
| // BitcoinConfig defines the configuration for Bitcoin. | ||
| type BitcoinConfig struct { |
There was a problem hiding this comment.
What about naming it just Config? We would have electrum.Config living in pkg/bitcoin/electrum referenced from [bitcoin.electrum] section. I think it all makes sense.
There was a problem hiding this comment.
There is already such a structure in the electrum package and it contains config for electrum (it was added by Kuba and I copied it). It's the structure used by BitcoinConfig. So I cannot rename BitcoinConfig to Config unless I change the name of that structure as well.
There was a problem hiding this comment.
Right, I think we should have just one config (cc @nkuba) structure named Config:
package electrum
// Config defines the configuration for the Electrum Bitcoin client.
type Config struct {
// URL to the Electrum server in format: `hostname:port`.
URL string
}
Based on this conversation, we agreed that we are not configuring Bitcoin but we are configuring Electrum Bitcoin client. The configuration is in [bitcon.electrum] in the config and the structure is in pkg/bitcoin/electrum/config.go.
There was a problem hiding this comment.
If we want to use a nested structure in the config file:
[bitcoin.electrum]
URL = "url.to.electrum:1111"
then the corresponding structure in Golang should also be nested:
type BitcoinConfig struct {
Electrum Config
}
type Config struct {
URL string
}
If we don't use a nested structure, but just a simple non-nested Config structure, then the Viper package that we use for mapping config file to the Golang structure will be unable to read the configuration properly.
This PR adds a command for launching the maintainer for Bitcoin difficulty.
The relay maintainer can be launched using the command:
In the future we can add other maintainer tasks and launch the maintainer, e.g.:
Maintainer uses 3 groups of configuration flags:
ethereum(url, keyFile, etc.)electrum(url)maintainer(bitcoinDifficulty, spv, etc.)All the options can be provided on the command line or using a configuration file or a mix of them.
Here is an example configuration toml file:
Tested locally.