Skip to content

Commit

Permalink
Disable CFund client functionality (#623)
Browse files Browse the repository at this point in the history
* disable cfund client functionality

* enable vote
  • Loading branch information
alex v authored Nov 13, 2019
1 parent 1e73c05 commit 09ea936
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class CMainParams : public CChainParams {
consensus.nStaticReward = 2 * COIN;
consensus.nHeightv451Fork = 2722100;
consensus.nHeightv452Fork = 2882875;
consensus.fDaoClientActivated = false;

/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
consensus.nCoinbaseMaturity = 50;
Expand Down Expand Up @@ -328,6 +329,7 @@ class CTestNetParams : public CChainParams {
consensus.nStaticReward = 2 * COIN;
consensus.nHeightv451Fork = 100000;
consensus.nHeightv452Fork = 100000;
consensus.fDaoClientActivated = true;

/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
consensus.nCoinbaseMaturity = 50;
Expand Down Expand Up @@ -509,6 +511,7 @@ class CDevNetParams : public CChainParams {
consensus.nStaticReward = 2 * COIN;
consensus.nHeightv451Fork = 1000;
consensus.nHeightv452Fork = 1000;
consensus.fDaoClientActivated = true;

/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
consensus.nCoinbaseMaturity = 5;
Expand Down Expand Up @@ -700,6 +703,7 @@ class CRegTestParams : public CChainParams {
consensus.nStaticReward = 2 * COIN;
consensus.nHeightv451Fork = 1000;
consensus.nHeightv452Fork = 1000;
consensus.fDaoClientActivated = true;

/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
consensus.nCoinbaseMaturity = 50;
Expand Down
2 changes: 2 additions & 0 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ struct Params {
int nHeightv451Fork;
int nHeightv452Fork;

bool fDaoClientActivated;

/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
int nCoinbaseMaturity;

Expand Down
2 changes: 2 additions & 0 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ CBlockTemplate* BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn, bo
coinbaseTx.vout[0].scriptPubKey = scriptPubKeyIn;
coinbaseTx.vout[0].nValue = GetBlockSubsidy(nHeight, chainparams.GetConsensus());
}

coinbaseTx.vin[0].scriptSig = CScript() << nHeight << OP_0;

if(IsCommunityFundEnabled(pindexPrev, chainparams.GetConsensus()))
{
std::map<uint256, bool> votes;
Expand Down
22 changes: 22 additions & 0 deletions src/qt/communityfundpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,17 @@ void CommunityFundPage::click_radioButtonExpired()

void CommunityFundPage::click_pushButtonCreateProposal()
{
if (!Params().GetConsensus().fDaoClientActivated)
{
QMessageBox msgBox(this);
QString str = tr("This function is temporarily disabled");
msgBox.setText(str);
msgBox.addButton(tr("Ok"), QMessageBox::AcceptRole);
msgBox.setIcon(QMessageBox::Information);
msgBox.setWindowTitle(str);
msgBox.exec();
return;
}
CommunityFundCreateProposalDialog dlg(this);
dlg.setModel(walletModel);
dlg.exec();
Expand All @@ -400,6 +411,17 @@ void CommunityFundPage::click_pushButtonCreateProposal()

void CommunityFundPage::click_pushButtonCreatePaymentRequest()
{
if (!Params().GetConsensus().fDaoClientActivated)
{
QMessageBox msgBox(this);
QString str = tr("This function is temporarily disabled");
msgBox.setText(str);
msgBox.addButton(tr("Ok"), QMessageBox::AcceptRole);
msgBox.setIcon(QMessageBox::Information);
msgBox.setWindowTitle(str);
msgBox.exec();
return;
}
CommunityFundCreatePaymentRequestDialog dlg(this);
dlg.setModel(walletModel);
dlg.exec();
Expand Down
1 change: 1 addition & 0 deletions src/qt/communityfundpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <consensus/cfund.h>
#include <wallet/wallet.h>

#include <QMessageBox>
#include <QWidget>
#include <QPushButton>
#include <QListView>
Expand Down
6 changes: 6 additions & 0 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ UniValue createproposal(const UniValue& params, bool fHelp)
+ HelpExampleCli("createproposal", "\"NQFqqMUD55ZV3PJEJZtaKCsQmjLT6JkjvJ\" 12000 3600 \"Promotional stickers for everyone\" 100")
);

if (!Params().GetConsensus().fDaoClientActivated)
throw JSONRPCError(RPC_WALLET_ERROR, "This command is temporarily disabled");

LOCK2(cs_main, pwalletMain->cs_wallet);

CNavCoinAddress address("NQFqqMUD55ZV3PJEJZtaKCsQmjLT6JkjvJ"); // Dummy address
Expand Down Expand Up @@ -691,6 +694,9 @@ UniValue createpaymentrequest(const UniValue& params, bool fHelp)
+ HelpExampleCli("createpaymentrequest", "\"196a4c2115d3c1c1dce1156eb2404ad77f3c5e9f668882c60cb98d638313dbd3\" 1000 \"Invoice March 2017\"")
);

if (!Params().GetConsensus().fDaoClientActivated)
throw JSONRPCError(RPC_WALLET_ERROR, "This command is temporarily disabled");

LOCK2(cs_main, pwalletMain->cs_wallet);

CFund::CProposal proposal;
Expand Down

0 comments on commit 09ea936

Please sign in to comment.