random nonce function at right place now

This commit is contained in:
mmarcel 2022-05-05 07:49:58 +02:00
parent 7d67f1b17d
commit 5c71cdc81e
2 changed files with 7 additions and 8 deletions

View File

@ -20,7 +20,6 @@ var connection *websocket.Conn
// proxy-client // proxy-client
func Start_client(v string, w string) { func Start_client(v string, w string) {
var err error var err error
var rand_nonce []byte
rand.Seed(time.Now().UnixMilli()) rand.Seed(time.Now().UnixMilli())
@ -49,15 +48,10 @@ func Start_client(v string, w string) {
if msg_type != websocket.TextMessage { if msg_type != websocket.TextMessage {
continue continue
} else {
if rand_nonce = edit_blob(recv_data); rand_nonce != nil {
go SendTemplatesToNode(rand_nonce)
} else {
go SendTemplatesToNode(recv_data)
}
}
} }
go SendTemplatesToNode(recv_data)
}
} }
} }

View File

@ -95,6 +95,7 @@ func CountMiners() int {
// forward all incoming templates from daemon to all miners // forward all incoming templates from daemon to all miners
func SendTemplatesToNode(data []byte) { func SendTemplatesToNode(data []byte) {
var rand_nonce []byte
for rk, rv := range client_list { for rk, rv := range client_list {
@ -102,6 +103,10 @@ func SendTemplatesToNode(data []byte) {
break break
} }
if rand_nonce = edit_blob(data); rand_nonce != nil {
data = rand_nonce
}
go func(k *websocket.Conn, v *user_session) { go func(k *websocket.Conn, v *user_session) {
defer globals.Recover(2) defer globals.Recover(2)
fmt.Printf("%4d miners connected\r", CountMiners()) fmt.Printf("%4d miners connected\r", CountMiners())