fixed broken repo

This commit is contained in:
8lecramm 2022-05-28 12:52:52 +02:00 committed by GitHub
parent 7d88c5ac2c
commit b586355300
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 4 deletions

View File

@ -4,12 +4,13 @@ var command_line string = `derohe-proxy
Proxy to combine all miners and to reduce network load Proxy to combine all miners and to reduce network load
Usage: Usage:
derohe-proxy [--listen-address=<127.0.0.1:10100>] [--log-interval=<60>] --daemon-address=<1.2.3.4:10100> derohe-proxy [--listen-address=<127.0.0.1:10100>] [--log-interval=<60>] [--minimal-jobs] --daemon-address=<1.2.3.4:10100>
Options: Options:
--listen-address=<127.0.0.1:10100> bind to specific address:port, default is 0.0.0.0:10200 --listen-address=<127.0.0.1:10100> bind to specific address:port, default is 0.0.0.0:10200
--daemon-address=<1.2.3.4:10100> connect to this daemon --daemon-address=<1.2.3.4:10100> connect to this daemon
--log-interval=<60> set logging interval in seconds (range 60 - 3600), default is 60 seconds --log-interval=<60> set logging interval in seconds (range 60 - 3600), default is 60 seconds
--minimal-jobs forward only 2 jobs per block (1 for miniblocks and 1 for final miniblock), by default all jobs are forwarded
Example Mainnet: ./derohe-proxy --daemon-address=minernode1.dero.io:10100 Example Mainnet: ./derohe-proxy --daemon-address=minernode1.dero.io:10100
` `
@ -22,3 +23,6 @@ var daemon_address string = "minernode1.dero.io:10100"
// logging interval in seconds // logging interval in seconds
var log_intervall int = 60 var log_intervall int = 60
// send only 2 jobs per block
var minimal = false

BIN
derohe-proxy Normal file

Binary file not shown.

View File

@ -51,6 +51,11 @@ func main() {
} }
} }
if Arguments["--minimal-jobs"] != nil {
minimal = true
fmt.Printf("Forward 2 jobs per block\n")
}
fmt.Printf("Logging every %d seconds\n", log_intervall) fmt.Printf("Logging every %d seconds\n", log_intervall)
go proxy.Start_server(listen_addr) go proxy.Start_server(listen_addr)
@ -59,7 +64,7 @@ func main() {
for proxy.CountMiners() < 1 { for proxy.CountMiners() < 1 {
time.Sleep(time.Second * 1) time.Sleep(time.Second * 1)
} }
go proxy.Start_client(daemon_address, proxy.Address) go proxy.Start_client(daemon_address, proxy.Address, minimal)
for { for {
time.Sleep(time.Second * time.Duration(log_intervall)) time.Sleep(time.Second * time.Duration(log_intervall))

View File

@ -18,8 +18,10 @@ var Minis uint64
var Rejected uint64 var Rejected uint64
// proxy-client // proxy-client
func Start_client(v string, w string) { func Start_client(v string, w string, min_jobs bool) {
var err error var err error
var last_diff uint64
var last_height uint64
rand.Seed(time.Now().UnixMilli()) rand.Seed(time.Now().UnixMilli())
@ -60,7 +62,15 @@ func Start_client(v string, w string) {
Minis = params.MiniBlocks Minis = params.MiniBlocks
Rejected = params.Rejected Rejected = params.Rejected
go SendTemplateToNodes(recv_data) if min_jobs {
if params.Height != last_height || params.Difficultyuint64 != last_diff {
last_height = params.Height
last_diff = params.Difficultyuint64
go SendTemplateToNodes(recv_data)
}
} else {
go SendTemplateToNodes(recv_data)
}
} }
} }
} }