Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mining: add compile time option to disable p2pool #3926

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ option(STATIC "Link libraries statically, requires static Qt")
option(USE_DEVICE_TREZOR "Trezor support compilation" ON)
option(WITH_SCANNER "Enable webcam QR scanner" OFF)
option(WITH_DESKTOP_ENTRY "Ask to install desktop entry on first startup" ON)
option(WITH_P2POOL "Enable mining with P2Pool" ON)
option(DEV_MODE "Checkout latest monero master on build" OFF)

list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/cmake")
Expand Down Expand Up @@ -87,6 +88,10 @@ if(WITH_DESKTOP_ENTRY)
add_definitions(-DWITH_DESKTOP_ENTRY)
endif()

if(WITH_P2POOL)
add_definitions(-DWITH_P2POOL)
endif()

# Sodium
find_library(SODIUM_LIBRARY sodium)
message(STATUS "libsodium: libraries at ${SODIUM_LIBRARY}")
Expand Down
10 changes: 8 additions & 2 deletions pages/Mining.qml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Rectangle {
property alias miningHeight: mainLayout.height
property double currentHashRate: 0
property int threads: idealThreadCount / 2
property bool p2poolSelectedWithoutSupport: persistentSettings.allow_p2pool_mining && !builtWithP2Pool

ColumnLayout {
id: mainLayout
Expand Down Expand Up @@ -88,6 +89,11 @@ Rectangle {
text: qsTr("Mining may reduce the performance of other running applications and processes.") + translationManager.emptyString
}

MoneroComponents.WarningBox {
text: qsTr("Monero GUI is compiled with P2Pool support disabled.") + translationManager.emptyString
visible: p2poolSelectedWithoutSupport
}

GridLayout {
columns: 2
Layout.fillWidth: true
Expand Down Expand Up @@ -544,8 +550,8 @@ Rectangle {
}
appWindow.isMining = isMining;
updateStatusText(hashrate)
startSoloMinerButton.enabled = !appWindow.isMining && daemonReady
stopSoloMinerButton.enabled = !startSoloMinerButton.enabled && daemonReady
startSoloMinerButton.enabled = !appWindow.isMining && daemonReady && !p2poolSelectedWithoutSupport
stopSoloMinerButton.enabled = !startSoloMinerButton.enabled && daemonReady && !p2poolSelectedWithoutSupport
}

function update() {
Expand Down
6 changes: 6 additions & 0 deletions src/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,12 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
#endif
engine.rootContext()->setContextProperty("builtWithDesktopEntry", builtWithDesktopEntry);

bool builtWithP2Pool = false;
#ifdef WITH_P2POOL
builtWithP2Pool = true;
#endif
engine.rootContext()->setContextProperty("builtWithP2Pool", builtWithP2Pool);

engine.rootContext()->setContextProperty("moneroVersion", MONERO_VERSION_FULL);

// Load main window (context properties needs to be defined obove this line)
Expand Down