Skip to content
Merged
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
16 changes: 0 additions & 16 deletions src/rpcblockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ CBlockIndex* GetHistoricalMagnitude(std::string cpid);
extern std::string GetProvableVotingWeightXML();
bool AskForOutstandingBlocks(uint256 hashStart);
bool ForceReorganizeToHash(uint256 NewHash);
extern std::string SendReward(std::string sAddress, int64_t nAmount);
extern double GetMagnitudeByCpidFromLastSuperblock(std::string sCPID);
extern std::string SuccessFail(bool f);
extern UniValue GetUpgradedBeaconReport();
Expand Down Expand Up @@ -3123,21 +3122,6 @@ UniValue GetJSONVersionReport()
return results;
}

std::string SendReward(std::string sAddress, int64_t nAmount)
{
CBitcoinAddress address(sAddress);
if (!address.IsValid()) return "Invalid Gridcoin address";
// Wallet comments
CWalletTx wtx;
if (pwalletMain->IsLocked()) return "Error: Please enter the wallet passphrase with walletpassphrase first.";
std::string sMessageType = "<MT>REWARD</MT>";
std::string sMessageValue = "<MV>" + sAddress + "</MV>";
wtx.hashBoinc = sMessageType + sMessageValue;
string strError = pwalletMain->SendMoneyToDestinationWithMinimumBalance(address.Get(), nAmount, 1, wtx);
if (!strError.empty()) return strError;
return wtx.GetHash().GetHex().c_str();
}

std::string SuccessFail(bool f)
{
return f ? "SUCCESS" : "FAIL";
Expand Down
51 changes: 0 additions & 51 deletions src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

using namespace std;

std::string SendReward(std::string sAddress, int64_t nAmount);
int64_t GetRSAWeightByCPID(std::string cpid);

MiningCPID DeserializeBoincBlock(std::string block);
Expand Down Expand Up @@ -567,41 +566,6 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)

// notify an external script when a wallet transaction comes in or is updated
std::string strCmd = GetArg("-walletnotify", "");
// Reward Sharing - Added 08-21-2016
// if (IsCoinBase() || IsCoinStake())

if (wtxIn.IsCoinBase() || wtxIn.IsCoinStake())
{
if (fDebug10) LogPrintf("CoinBase:CoinStake");
CBlockIndex* pBlk = mapBlockIndex[wtxIn.hashBlock];
CBlock blk;
bool r = blk.ReadFromDisk(pBlk);
if (r)
{
MiningCPID bb = DeserializeBoincBlock(blk.vtx[0].hashBoinc,blk.nVersion);
double dResearch = bb.ResearchSubsidy + bb.InterestSubsidy;
double dRewardShare = dResearch*.10;
// Only send Reward if > .10 GRC
if (dRewardShare > .10)
{
// Only send reward if Reward Sharing is set up in the conf file (RS=RewardReceiveAddress)
std::string sRewardAddress = GetArgument("RS","");
if (!sRewardAddress.empty())
{
// Ensure this Proof Of Stake Coinbase was Just Generated before sending the reward (prevent rescans from sending rewards):
LogPrintf("reward locktime %" PRId64 " curr time %" PRId64, wtxIn.nTime, GetAdjustedTime());
LogPrintf(" reward shared %f", dRewardShare);
LogPrintf(" addr %s",sRewardAddress);
if (IsLockTimeWithinMinutes(wtxIn.nTime, GetAdjustedTime(), 10))
{
std::string sResult = SendReward(sRewardAddress,CoinFromValue(dRewardShare));
LogPrintf("Issuing Reward Share of %f GRC to %s. Response: %s",dRewardShare,sRewardAddress, sResult);
}
}
}
}
}

if (!strCmd.empty())
{
boost::replace_all(strCmd, "%s", wtxIn.GetHash().GetHex());
Expand Down Expand Up @@ -1892,21 +1856,6 @@ string CWallet::SendMoney(CScript scriptPubKey, int64_t nValue, CWalletTx& wtxNe
return "";
}




string CWallet::SendMoneyToDestinationWithMinimumBalance(const CTxDestination& address, int64_t nValue, int64_t nMinimumBalanceRequired, CWalletTx& wtxNew)
{
// Check amount
if (nValue + nTransactionFee > GetBalance()) return _("Insufficient funds");
if (GetBalance() < nMinimumBalanceRequired) return _("Balance too low to create a smart contract.");
CScript scriptPubKey;
scriptPubKey.SetDestination(address);
return SendMoney(scriptPubKey, nValue, wtxNew, false);
}



string CWallet::SendMoneyToDestination(const CTxDestination& address, int64_t nValue, CWalletTx& wtxNew, bool fAskFee)
{
// Check amount
Expand Down
1 change: 0 additions & 1 deletion src/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ class CWallet : public CCryptoKeyStore

std::string SendMoney(CScript scriptPubKey, int64_t nValue, CWalletTx& wtxNew, bool fAskFee=false);
std::string SendMoneyToDestination(const CTxDestination &address, int64_t nValue, CWalletTx& wtxNew, bool fAskFee=false);
std::string SendMoneyToDestinationWithMinimumBalance(const CTxDestination& address, int64_t nValue, int64_t nMinimumBalanceRequired, CWalletTx& wtxNew);

bool NewKeyPool();
bool TopUpKeyPool(unsigned int nSize = 0);
Expand Down