-
Notifications
You must be signed in to change notification settings - Fork 86
/
remote_miner_main.go
51 lines (44 loc) · 1.75 KB
/
remote_miner_main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"flag"
"github.com/deso-protocol/backend/miner"
"github.com/golang/glog"
)
var (
flagRemoteBlockProducer = flag.String(
"remote_block_producer", "http://localhost:17001",
"The HTTP(S)://IP:PORT or HTTP(S)://DOMAIN:PORT of a node that is running a block producer. "+
"This node will be used to get block templates that the miner can hash on")
flagMinerPublicKey = flag.String(
"miner_public_key", "",
"Indicates where to send "+
"block rewards from mining blocks. Public key must be "+
"a compressed ECDSA public key formatted as a base58Check string.")
flagNumMiningThreads = flag.Int64(
"num_mining_threads", 0,
"How many threads to run for mining. If set to zero, which is the default, "+
"then the number of threads available to the system will be used.")
flagIterationsPerCycle = flag.Int64(
"iterations_per_cycle", 1000,
"How many iterations to run before we check whether or not we've hit the "+
"difficulty target. This flag isn't very important anymore, and "+
"setting it lower or higher shouldn't affect performance very much.")
flagTemplateRefreshIntervalSeconds = flag.Float64(
"template_refresh_interval_seconds", 5.0,
"How often the BlockProducer is queried for a fresh set of templates.")
)
func main() {
// Set up logging.
flag.Set("alsologtostderr", "true")
flag.Parse()
glog.CopyStandardLogTo("INFO")
if *flagMinerPublicKey == "" {
panic("--miner_public_key is required. Must be a Base58Check " +
"public key (starts with BC/tBC depending on mainnet/testnet)")
}
// Create a RemoteMiner
remoteMiner := miner.NewRemoteMiner(
*flagRemoteBlockProducer, *flagMinerPublicKey, *flagNumMiningThreads,
*flagIterationsPerCycle, *flagTemplateRefreshIntervalSeconds)
remoteMiner.Start()
}