Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
xenartist committed Jan 10, 2025
2 parents c159903 + 238011e commit 760500c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ui/menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func CreateMainMenu() *tview.List {
mainMenu := tview.NewList().
AddItem("unmineable-solXEN (5.4.2)", "", 0, nil).
AddItem("unmineable-solXEN (5.5.0)", "", 0, nil).
AddItem(WALLET_STRING, "", 'a', nil).
AddItem(SOLXEN_CPU_MINER_STRING, "", 'b', func() {
UpdateCPUMinerPublicKeyTextView() // Update the Public Key text view
Expand Down
20 changes: 19 additions & 1 deletion ui/solxencpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,25 @@ import (
"xoon/utils"
xenblocks "xoon/xmrig"

"runtime"
"strconv"

"github.com/rivo/tview"
)

var solxencpuForm *tview.Form = tview.NewForm()

// Add this helper function to generate thread options
func generateThreadOptions() []string {
maxThreads := runtime.NumCPU()
options := []string{"1"} // Start with 1 thread

for threads := 2; threads <= maxThreads; threads *= 2 {
options = append(options, strconv.Itoa(threads))
}
return options
}

func CreateSolXENCPUUI(app *tview.Application) ModuleUI {
var moduleUI = CreateModuleUI(SOLXEN_CPU_MINER_STRING, app)

Expand All @@ -24,8 +38,12 @@ func CreateSolXENCPUUI(app *tview.Application) ModuleUI {
}

var selectedAlgorithm, selectedPort, workerName string
var selectedThreads string = "1" // Default value

solxencpuForm.AddTextView("Public Key", publicKeyDisplay, 0, 1, false, true).
AddDropDown("CPU Threads", generateThreadOptions(), 0, func(option string, index int) {
selectedThreads = option
}).
AddDropDown("Mining Algorithm", xenblocks.CPUAlgorithms, 0, func(option string, index int) {
selectedAlgorithm = option
}).
Expand All @@ -40,7 +58,7 @@ func CreateSolXENCPUUI(app *tview.Application) ModuleUI {
if !xenblocks.IsMining() {
publicKey := utils.GetGlobalPublicKey()
xenblocks.StartMining(app, moduleUI.LogView, utils.LogMessage,
publicKey, selectedAlgorithm, selectedPort, workerName)
publicKey, selectedThreads, selectedAlgorithm, selectedPort, workerName)
}
}).
AddButton("Stop Mining", func() {
Expand Down
3 changes: 2 additions & 1 deletion xmrig/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var CPUAlgorithms = []string{"GhostRider", "RandomX"}
var CPUMiningPorts = []string{"443", "3333", "13333", "80"}

func StartMining(app *tview.Application, logView *tview.TextView, logMessage utils.LogMessageFunc,
publicKey string, selectedAlgorithm string, selectedPort string, workerName string) {
publicKey string, selectedThreads string, selectedAlgorithm string, selectedPort string, workerName string) {

isMining = true

Expand Down Expand Up @@ -62,6 +62,7 @@ func StartMining(app *tview.Application, logView *tview.TextView, logMessage uti
// Construct the arguments slice
args := []string{
"-a", algorithm,
"-t", selectedThreads,
"-o", miningAddress,
"-u", fmt.Sprintf("SOL:%s.%s#plxp-imd8", publicKey, workerName),
"-p", "x",
Expand Down

0 comments on commit 760500c

Please sign in to comment.