From 8fdbc1ddda5ba7896f04ab1c156f5397ac6ea034 Mon Sep 17 00:00:00 2001 From: unek Date: Wed, 25 Jun 2014 15:20:43 +0200 Subject: [PATCH] toggleable staking --- src/init.cpp | 1 + src/net.cpp | 7 +++++-- src/qt/bitcoingui.cpp | 17 ++++++++++------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index a41e904..c179ffc 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -245,6 +245,7 @@ std::string HelpMessage() " -listen " + _("Accept connections from outside (default: 1 if no -proxy or -connect)") + "\n" + " -bind= " + _("Bind to given address. Use [host]:port notation for IPv6") + "\n" + " -dnsseed " + _("Find peers using DNS lookup (default: 1)") + "\n" + + " -staking " + _("Stake your coins to support network and gain reward (default: 1)") + "\n" + " -nosynccheckpoints " + _("Disable sync checkpoints (default: 0)") + "\n" + " -banscore= " + _("Threshold for disconnecting misbehaving peers (default: 100)") + "\n" + " -bantime= " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n" + diff --git a/src/net.cpp b/src/net.cpp index 52e1167..6af358f 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1886,8 +1886,11 @@ void StartNode(void* parg) printf("Error; NewThread(ThreadDumpAddress) failed\n"); // ppcoin: mint proof-of-stake blocks in the background - if (!NewThread(ThreadStakeMinter, pwalletMain)) - printf("Error: NewThread(ThreadStakeMinter) failed\n"); + if (!GetBoolArg("-staking", true)) + printf("Staking disabled\n"); + else + if (!NewThread(ThreadStakeMinter, pwalletMain)) + printf("Error: NewThread(ThreadStakeMinter) failed\n"); // Generate coins in the background GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 4922364..2a26b18 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -153,13 +153,16 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): labelMintingIcon->setPixmap(QIcon(":/icons/minting").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); labelMintingIcon->setEnabled(false); // Add timer to update minting icon - QTimer *timerMintingIcon = new QTimer(labelMintingIcon); - timerMintingIcon->start(MODEL_UPDATE_DELAY); - connect(timerMintingIcon, SIGNAL(timeout()), this, SLOT(updateMintingIcon())); - // Add timer to update minting weights - QTimer *timerMintingWeights = new QTimer(labelMintingIcon); - timerMintingWeights->start(30 * 1000); - connect(timerMintingWeights, SIGNAL(timeout()), this, SLOT(updateMintingWeights())); + if (GetBoolArg("-staking", true)) + { + QTimer *timerMintingIcon = new QTimer(labelMintingIcon); + timerMintingIcon->start(MODEL_UPDATE_DELAY); + connect(timerMintingIcon, SIGNAL(timeout()), this, SLOT(updateMintingIcon())); + // Add timer to update minting weights + QTimer *timerMintingWeights = new QTimer(labelMintingIcon); + timerMintingWeights->start(30 * 1000); + connect(timerMintingWeights, SIGNAL(timeout()), this, SLOT(updateMintingWeights())); + } // Set initial values for user and network weights nWeight, nNetworkWeight = 0;