Skip to content

Commit

Permalink
[RPC] Disable/Hide multisend
Browse files Browse the repository at this point in the history
  • Loading branch information
random-zebra committed Apr 26, 2020
1 parent 7ac2aee commit f50918e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 36 deletions.
28 changes: 3 additions & 25 deletions src/wallet/rpcwallet.cpp
Expand Up @@ -3178,6 +3178,8 @@ unsigned int sumMultiSend()

UniValue multisend(const UniValue& params, bool fHelp)
{
throw std::runtime_error("Multisend is disabled in this wallet version");
/* disable multisend
CWalletDB walletdb(pwalletMain->strWalletFile);
bool fFileBacked;
//MultiSend Commands
Expand Down Expand Up @@ -3285,31 +3287,6 @@ UniValue multisend(const UniValue& params, bool fHelp)
}
}
//if no commands are used
if (fHelp || params.size() != 2)
throw std::runtime_error(
"multisend <command>\n"
"****************************************************************\n"
"WHAT IS MULTISEND?\n"
"MultiSend allows a user to automatically send a percent of their stake reward to as many addresses as you would like\n"
"The MultiSend transaction is sent when the staked coins mature (100 confirmations)\n"
"****************************************************************\n"
"TO CREATE OR ADD TO THE MULTISEND VECTOR:\n"
"multisend <PIVX Address> <percent>\n"
"This will add a new address to the MultiSend vector\n"
"Percent is a whole number 1 to 100.\n"
"****************************************************************\n"
"MULTISEND COMMANDS (usage: multisend <command>)\n"
" print - displays the current MultiSend vector \n"
" clear - deletes the current MultiSend vector \n"
" enablestake/activatestake - activates the current MultiSend vector to be activated on stake rewards\n"
" enablemasternode/activatemasternode - activates the current MultiSend vector to be activated on masternode rewards\n"
" disable/deactivate - disables the current MultiSend vector \n"
" delete <Address #> - deletes an address from the MultiSend vector \n"
" disable <address> - prevents a specific address from sending MultiSend transactions\n"
" enableall - enables all addresses to be eligible to send MultiSend transactions\n"
"****************************************************************\n");

//if the user is entering a new MultiSend item
std::string strAddress = params[0].get_str();
CBitcoinAddress address(strAddress);
Expand Down Expand Up @@ -3351,6 +3328,7 @@ UniValue multisend(const UniValue& params, bool fHelp)
}
}
return printMultiSend();
*/
}

UniValue getzerocoinbalance(const UniValue& params, bool fHelp)
Expand Down
36 changes: 25 additions & 11 deletions src/wallet/walletdb.cpp
Expand Up @@ -177,9 +177,10 @@ bool CWalletDB::WriteCustomFeeValue(const CAmount& nFee)
return Write(std::string("nCustomFee"), nFee);
}

//presstab HyperStake
bool CWalletDB::WriteMultiSend(std::vector<std::pair<std::string, int> > vMultiSend)
{
return false;
/* disable multisend
nWalletDBUpdated++;
bool ret = true;
for (unsigned int i = 0; i < vMultiSend.size(); i++) {
Expand All @@ -189,10 +190,13 @@ bool CWalletDB::WriteMultiSend(std::vector<std::pair<std::string, int> > vMultiS
ret = false;
}
return ret;
*/
}
//presstab HyperStake

bool CWalletDB::EraseMultiSend(std::vector<std::pair<std::string, int> > vMultiSend)
{
return false;
/* disable multisend
nWalletDBUpdated++;
bool ret = true;
for (unsigned int i = 0; i < vMultiSend.size(); i++) {
Expand All @@ -202,38 +206,49 @@ bool CWalletDB::EraseMultiSend(std::vector<std::pair<std::string, int> > vMultiS
ret = false;
}
return ret;
*/
}
//presstab HyperStake

bool CWalletDB::WriteMSettings(bool fMultiSendStake, bool fMultiSendMasternode, int nLastMultiSendHeight)
{
return false;
/* disable multisend
nWalletDBUpdated++;
std::pair<bool, bool> enabledMS(fMultiSendStake, fMultiSendMasternode);
std::pair<std::pair<bool, bool>, int> pSettings(enabledMS, nLastMultiSendHeight);
return Write(std::string("msettingsv2"), pSettings, true);
*/
}
//presstab HyperStake

bool CWalletDB::WriteMSDisabledAddresses(std::vector<std::string> vDisabledAddresses)
{
return false;
/* disable multisend
nWalletDBUpdated++;
bool ret = true;
for (unsigned int i = 0; i < vDisabledAddresses.size(); i++) {
if (!Write(std::make_pair(std::string("mdisabled"), i), vDisabledAddresses[i]))
ret = false;
}
return ret;
*/
}
//presstab HyperStake

bool CWalletDB::EraseMSDisabledAddresses(std::vector<std::string> vDisabledAddresses)
{
return false;
/* disable multisend
nWalletDBUpdated++;
bool ret = true;
for (unsigned int i = 0; i < vDisabledAddresses.size(); i++) {
if (!Erase(std::make_pair(std::string("mdisabled"), i)))
ret = false;
}
return ret;
*/
}

bool CWalletDB::WriteAutoCombineSettings(bool fEnable, CAmount nCombineThreshold)
{
nWalletDBUpdated++;
Expand Down Expand Up @@ -638,27 +653,26 @@ bool ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, CW
ssValue >> pwallet->fUseCustomFee;
} else if (strType == "nCustomFee") {
ssValue >> pwallet->nCustomFee;
} else if (strType == "multisend") //presstab HyperStake
{
/* disable multisend
} else if (strType == "multisend") {
unsigned int i;
ssKey >> i;
std::pair<std::string, int> pMultiSend;
ssValue >> pMultiSend;
if (CBitcoinAddress(pMultiSend.first).IsValid()) {
pwallet->vMultiSend.push_back(pMultiSend);
}
} else if (strType == "msettingsv2") //presstab HyperStake
{
} else if (strType == "msettingsv2") {
std::pair<std::pair<bool, bool>, int> pSettings;
ssValue >> pSettings;
pwallet->fMultiSendStake = pSettings.first.first;
pwallet->fMultiSendMasternodeReward = pSettings.first.second;
pwallet->nLastMultiSendHeight = pSettings.second;
} else if (strType == "mdisabled") //presstab HyperStake
{
} else if (strType == "mdisabled") {
std::string strDisabledAddress;
ssValue >> strDisabledAddress;
pwallet->vDisabledAddresses.push_back(strDisabledAddress);
*/
} else if (strType == "autocombinesettings") {
std::pair<bool, CAmount> pSettings;
ssValue >> pSettings;
Expand Down

0 comments on commit f50918e

Please sign in to comment.