Updates monetary variable int64_t types to CAmount.

Closes #677
This commit is contained in:
CryptoVote 2016-01-23 22:21:14 -06:00 committed by Holger Schinzel
parent 42121955b6
commit 3f4d5c4c7d
10 changed files with 87 additions and 86 deletions

View File

@ -173,7 +173,7 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand
}
std::vector<CTxIn> in;
int64_t nAmount;
CAmount nAmount;
CTransaction txCollateral;
std::vector<CTxOut> out;
vRecv >> in >> nAmount >> txCollateral >> out;
@ -197,8 +197,8 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand
//check it like a transaction
{
int64_t nValueIn = 0;
int64_t nValueOut = 0;
CAmount nValueIn = 0;
CAmount nValueOut = 0;
bool missingTx = false;
CValidationState state;
@ -936,8 +936,8 @@ bool CDarksendPool::IsCollateralValid(const CTransaction& txCollateral){
if(txCollateral.vout.size() < 1) return false;
if(txCollateral.nLockTime != 0) return false;
int64_t nValueIn = 0;
int64_t nValueOut = 0;
CAmount nValueIn = 0;
CAmount nValueOut = 0;
bool missingTx = false;
BOOST_FOREACH(const CTxOut o, txCollateral.vout){
@ -990,7 +990,7 @@ bool CDarksendPool::IsCollateralValid(const CTransaction& txCollateral){
//
// Add a clients transaction to the pool
//
bool CDarksendPool::AddEntry(const std::vector<CTxIn>& newInput, const int64_t& nAmount, const CTransaction& txCollateral, const std::vector<CTxOut>& newOutput, int& errorID){
bool CDarksendPool::AddEntry(const std::vector<CTxIn>& newInput, const CAmount& nAmount, const CTransaction& txCollateral, const std::vector<CTxOut>& newOutput, int& errorID){
if (!fMasterNode) return false;
BOOST_FOREACH(CTxIn in, newInput) {
@ -1092,7 +1092,7 @@ bool CDarksendPool::SignaturesComplete(){
// Execute a Darksend denomination via a Masternode.
// This is only ran from clients
//
void CDarksendPool::SendDarksendDenominate(std::vector<CTxIn>& vin, std::vector<CTxOut>& vout, int64_t amount){
void CDarksendPool::SendDarksendDenominate(std::vector<CTxIn>& vin, std::vector<CTxOut>& vout, CAmount amount){
if(fMasterNode) {
LogPrintf("CDarksendPool::SendDarksendDenominate() - Darksend from a Masternode is not supported currently.\n");
@ -1139,7 +1139,7 @@ void CDarksendPool::SendDarksendDenominate(std::vector<CTxIn>& vin, std::vector<
//check it against the memory pool to make sure it's valid
{
int64_t nValueOut = 0;
CAmount nValueOut = 0;
CValidationState state;
CMutableTransaction tx;
@ -1652,8 +1652,8 @@ bool CDarksendPool::PrepareDarksendDenominate()
bool CDarksendPool::SendRandomPaymentToSelf()
{
int64_t nBalance = pwalletMain->GetBalance();
int64_t nPayment = (nBalance*0.35) + (rand() % nBalance);
CAmount nBalance = pwalletMain->GetBalance();
CAmount nPayment = (nBalance*0.35) + (rand() % nBalance);
if(nPayment > nBalance) nPayment = nBalance-(0.1*COIN);
@ -1666,9 +1666,9 @@ bool CDarksendPool::SendRandomPaymentToSelf()
scriptChange = GetScriptForDestination(vchPubKey.GetID());
CWalletTx wtx;
int64_t nFeeRet = 0;
CAmount nFeeRet = 0;
std::string strFail = "";
vector< pair<CScript, int64_t> > vecSend;
vector< pair<CScript, CAmount> > vecSend;
// ****** Add fees ************ /
vecSend.push_back(make_pair(scriptChange, nPayment));
@ -1691,9 +1691,9 @@ bool CDarksendPool::SendRandomPaymentToSelf()
bool CDarksendPool::MakeCollateralAmounts()
{
CWalletTx wtx;
int64_t nFeeRet = 0;
CAmount nFeeRet = 0;
std::string strFail = "";
vector< pair<CScript, int64_t> > vecSend;
vector< pair<CScript, CAmount> > vecSend;
CCoinControl *coinControl = NULL;
// make our collateral address
@ -1740,13 +1740,13 @@ bool CDarksendPool::MakeCollateralAmounts()
}
// Create denominations
bool CDarksendPool::CreateDenominated(int64_t nTotalValue)
bool CDarksendPool::CreateDenominated(CAmount nTotalValue)
{
CWalletTx wtx;
int64_t nFeeRet = 0;
CAmount nFeeRet = 0;
std::string strFail = "";
vector< pair<CScript, int64_t> > vecSend;
int64_t nValueLeft = nTotalValue;
vector< pair<CScript, CAmount> > vecSend;
CAmount nValueLeft = nTotalValue;
// make our collateral address
CReserveKey reservekeyCollateral(pwalletMain);
@ -1768,7 +1768,7 @@ bool CDarksendPool::CreateDenominated(int64_t nTotalValue)
// ****** Add denoms ************ /
BOOST_REVERSE_FOREACH(int64_t v, darkSendDenominations){
BOOST_REVERSE_FOREACH(CAmount v, darkSendDenominations){
// Note: denoms are skipped if there are already DENOMS_COUNT_MAX of them
@ -1852,7 +1852,7 @@ bool CDarksendPool::IsCompatibleWithEntries(std::vector<CTxOut>& vout)
return true;
}
bool CDarksendPool::IsCompatibleWithSession(int64_t nDenom, CTransaction txCollateral, int& errorID)
bool CDarksendPool::IsCompatibleWithSession(CAmount nDenom, CTransaction txCollateral, int& errorID)
{
if(nDenom == 0) return false;
@ -1953,16 +1953,16 @@ int CDarksendPool::GetDenominations(const std::vector<CTxDSOut>& vout){
// return a bitshifted integer representing the denominations in this list
int CDarksendPool::GetDenominations(const std::vector<CTxOut>& vout, bool fSingleRandomDenom){
std::vector<pair<int64_t, int> > denomUsed;
std::vector<pair<CAmount, int> > denomUsed;
// make a list of denominations, with zero uses
BOOST_FOREACH(int64_t d, darkSendDenominations)
BOOST_FOREACH(CAmount d, darkSendDenominations)
denomUsed.push_back(make_pair(d, 0));
// look for denominations and update uses to 1
BOOST_FOREACH(CTxOut out, vout){
bool found = false;
BOOST_FOREACH (PAIRTYPE(int64_t, int)& s, denomUsed){
BOOST_FOREACH (PAIRTYPE(CAmount, int)& s, denomUsed){
if (out.nValue == s.first){
s.second = 1;
found = true;
@ -1975,7 +1975,7 @@ int CDarksendPool::GetDenominations(const std::vector<CTxOut>& vout, bool fSingl
int c = 0;
// if the denomination is used, shift the bit on.
// then move to the next
BOOST_FOREACH (PAIRTYPE(int64_t, int)& s, denomUsed) {
BOOST_FOREACH (PAIRTYPE(CAmount, int)& s, denomUsed) {
int bit = (fSingleRandomDenom ? rand()%2 : 1) * s.second;
denom |= bit << c++;
if(fSingleRandomDenom && bit) break; // use just one random denomination
@ -1992,12 +1992,12 @@ int CDarksendPool::GetDenominations(const std::vector<CTxOut>& vout, bool fSingl
}
int CDarksendPool::GetDenominationsByAmounts(std::vector<int64_t>& vecAmount){
int CDarksendPool::GetDenominationsByAmounts(std::vector<CAmount>& vecAmount){
CScript e = CScript();
std::vector<CTxOut> vout1;
// Make outputs by looping through denominations, from small to large
BOOST_REVERSE_FOREACH(int64_t v, vecAmount){
BOOST_REVERSE_FOREACH(CAmount v, vecAmount){
CTxOut o(v, e);
vout1.push_back(o);
}
@ -2005,14 +2005,14 @@ int CDarksendPool::GetDenominationsByAmounts(std::vector<int64_t>& vecAmount){
return GetDenominations(vout1, true);
}
int CDarksendPool::GetDenominationsByAmount(int64_t nAmount, int nDenomTarget){
int CDarksendPool::GetDenominationsByAmount(CAmount nAmount, int nDenomTarget){
CScript e = CScript();
int64_t nValueLeft = nAmount;
CAmount nValueLeft = nAmount;
std::vector<CTxOut> vout1;
// Make outputs by looping through denominations, from small to large
BOOST_REVERSE_FOREACH(int64_t v, darkSendDenominations){
BOOST_REVERSE_FOREACH(CAmount v, darkSendDenominations){
if(nDenomTarget != 0){
bool fAccepted = false;
if((nDenomTarget & (1 << 0)) && v == ((100*COIN)+100000)) {fAccepted = true;}
@ -2200,7 +2200,7 @@ void CDarksendPool::RelayFinalTransaction(const int sessionID, const CTransactio
}
}
void CDarksendPool::RelayIn(const std::vector<CTxDSIn>& vin, const int64_t& nAmount, const CTransaction& txCollateral, const std::vector<CTxDSOut>& vout)
void CDarksendPool::RelayIn(const std::vector<CTxDSIn>& vin, const CAmount& nAmount, const CTransaction& txCollateral, const std::vector<CTxDSOut>& vout)
{
if(!pSubmittedToMasternode) return;

View File

@ -46,9 +46,9 @@ class CActiveMasternode;
#define DARKSEND_RELAY_OUT 2
#define DARKSEND_RELAY_SIG 3
static const int64_t DARKSEND_COLLATERAL = (0.01*COIN);
static const int64_t DARKSEND_POOL_MAX = (999.99*COIN);
static const int64_t DENOMS_COUNT_MAX = 100;
static const CAmount DARKSEND_COLLATERAL = (0.01*COIN);
static const CAmount DARKSEND_POOL_MAX = (999.99*COIN);
static const CAmount DENOMS_COUNT_MAX = 100;
extern CDarksendPool darkSendPool;
extern CDarkSendSigner darkSendSigner;
@ -99,7 +99,7 @@ public:
bool isSet;
std::vector<CTxDSIn> sev;
std::vector<CTxDSOut> vout;
int64_t amount;
CAmount amount;
CTransaction collateral;
CTransaction txSupporting;
int64_t addedTime; // time in UTC milliseconds
@ -112,7 +112,7 @@ public:
}
/// Add entries to use for Darksend
bool Add(const std::vector<CTxIn> vinIn, int64_t amountIn, const CTransaction collateralIn, const std::vector<CTxOut> voutIn)
bool Add(const std::vector<CTxIn> vinIn, CAmount amountIn, const CTransaction collateralIn, const std::vector<CTxOut> voutIn)
{
if(isSet){return false;}
@ -291,7 +291,7 @@ private:
int64_t lastNewBlock;
std::vector<int64_t> darkSendDenominationsSkipped;
std::vector<CAmount> darkSendDenominationsSkipped;
//debugging data
std::string strAutoDenomResult;
@ -369,8 +369,8 @@ public:
darkSendDenominationsSkipped.clear();
}
bool IsDenomSkipped(int64_t denom) {
BOOST_FOREACH(int64_t d, darkSendDenominationsSkipped) {
bool IsDenomSkipped(CAmount denom) {
BOOST_FOREACH(CAmount d, darkSendDenominationsSkipped) {
if (d == denom) {
return true;
}
@ -450,7 +450,7 @@ public:
bool IsCompatibleWithEntries(std::vector<CTxOut>& vout);
/// Is this amount compatible with other client in the pool?
bool IsCompatibleWithSession(int64_t nAmount, CTransaction txCollateral, int &errorID);
bool IsCompatibleWithSession(CAmount nAmount, CTransaction txCollateral, int &errorID);
/// Passively run Darksend in the background according to the configuration in settings (only for QT)
bool DoAutomaticDenominating(bool fDryRun=false);
@ -470,13 +470,13 @@ public:
/// If the collateral is valid given by a client
bool IsCollateralValid(const CTransaction& txCollateral);
/// Add a clients entry to the pool
bool AddEntry(const std::vector<CTxIn>& newInput, const int64_t& nAmount, const CTransaction& txCollateral, const std::vector<CTxOut>& newOutput, int& errorID);
bool AddEntry(const std::vector<CTxIn>& newInput, const CAmount& nAmount, const CTransaction& txCollateral, const std::vector<CTxOut>& newOutput, int& errorID);
/// Add signature to a vin
bool AddScriptSig(const CTxIn& newVin);
/// Check that all inputs are signed. (Are all inputs signed?)
bool SignaturesComplete();
/// As a client, send a transaction to a Masternode to start the denomination process
void SendDarksendDenominate(std::vector<CTxIn>& vin, std::vector<CTxOut>& vout, int64_t amount);
void SendDarksendDenominate(std::vector<CTxIn>& vin, std::vector<CTxOut>& vout, CAmount amount);
/// Get Masternode updates about the progress of Darksend
bool StatusUpdate(int newState, int newEntriesCount, int newAccepted, int &errorID, int newSessionID=0);
@ -494,7 +494,7 @@ public:
/// Split up large inputs or make fee sized inputs
bool MakeCollateralAmounts();
bool CreateDenominated(int64_t nTotalValue);
bool CreateDenominated(CAmount nTotalValue);
/// Get the denominations for a list of outputs (returns a bitshifted integer)
int GetDenominations(const std::vector<CTxOut>& vout, bool fSingleRandomDenom = false);
@ -503,8 +503,8 @@ public:
void GetDenominationsToString(int nDenom, std::string& strDenom);
/// Get the denominations for a specific amount of dash.
int GetDenominationsByAmount(int64_t nAmount, int nDenomTarget=0); // is not used anymore?
int GetDenominationsByAmounts(std::vector<int64_t>& vecAmount);
int GetDenominationsByAmount(CAmount nAmount, int nDenomTarget=0); // is not used anymore?
int GetDenominationsByAmounts(std::vector<CAmount>& vecAmount);
std::string GetMessageByID(int messageID);
@ -515,7 +515,7 @@ public:
void RelayFinalTransaction(const int sessionID, const CTransaction& txNew);
void RelaySignaturesAnon(std::vector<CTxIn>& vin);
void RelayInAnon(std::vector<CTxIn>& vin, std::vector<CTxOut>& vout);
void RelayIn(const std::vector<CTxDSIn>& vin, const int64_t& nAmount, const CTransaction& txCollateral, const std::vector<CTxDSOut>& vout);
void RelayIn(const std::vector<CTxDSIn>& vin, const CAmount& nAmount, const CTransaction& txCollateral, const std::vector<CTxDSOut>& vout);
void RelayStatus(const int sessionID, const int newState, const int newEntriesCount, const int newAccepted, const int errorID=MSG_NOERR);
void RelayCompletedTransaction(const int sessionID, const bool error, const int errorID);
};

View File

@ -1534,14 +1534,14 @@ double ConvertBitsToDouble(unsigned int nBits)
return dDiff;
}
int64_t GetBlockValue(int nBits, int nHeight, const CAmount& nFees)
CAmount GetBlockValue(int nBits, int nHeight, const CAmount& nFees)
{
double dDiff = (double)0x0000ffff / (double)(nBits & 0x00ffffff);
/* fixed bug caused diff to not be correctly calculated */
if(nHeight > 4500 || Params().NetworkID() == CBaseChainParams::TESTNET) dDiff = ConvertBitsToDouble(nBits);
int64_t nSubsidy = 0;
CAmount nSubsidy = 0;
if(nHeight >= 5465) {
if((nHeight >= 17000 && dDiff > 75) || nHeight >= 24000) { // GPU/ASIC difficulty calc
// 2222222/(((x+2600)/9)^2)
@ -1584,9 +1584,9 @@ int64_t GetBlockValue(int nBits, int nHeight, const CAmount& nFees)
return nSubsidy + nFees;
}
int64_t GetMasternodePayment(int nHeight, int64_t blockValue)
CAmount GetMasternodePayment(int nHeight, CAmount blockValue)
{
int64_t ret = blockValue/5; // start at 20%
CAmount ret = blockValue/5; // start at 20%
if(Params().NetworkID() == CBaseChainParams::TESTNET) {
if(nHeight > 46000) ret += blockValue / 20; //25% - 2014-10-07

View File

@ -215,7 +215,7 @@ bool DisconnectBlocksAndReprocess(int blocks);
// ***TODO***
double ConvertBitsToDouble(unsigned int nBits);
int64_t GetMasternodePayment(int nHeight, int64_t blockValue);
CAmount GetMasternodePayment(int nHeight, CAmount blockValue);
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock);
bool ActivateBestChain(CValidationState &state, CBlock *pblock = NULL);

View File

@ -182,7 +182,7 @@ void DumpMasternodePayments()
LogPrintf("Budget dump finished %dms\n", GetTimeMillis() - nStart);
}
bool IsBlockValueValid(const CBlock& block, int64_t nExpectedValue){
bool IsBlockValueValid(const CBlock& block, CAmount nExpectedValue){
CBlockIndex* pindexPrev = chainActive.Tip();
if(pindexPrev == NULL) return true;
@ -267,7 +267,7 @@ bool IsBlockPayeeValid(const CTransaction& txNew, int nBlockHeight)
}
void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees)
void FillBlockPayee(CMutableTransaction& txNew, CAmount nFees)
{
CBlockIndex* pindexPrev = chainActive.Tip();
if(!pindexPrev) return;
@ -288,7 +288,7 @@ std::string GetRequiredPaymentsString(int nBlockHeight)
}
}
void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, int64_t nFees)
void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, CAmount nFees)
{
CBlockIndex* pindexPrev = chainActive.Tip();
if(!pindexPrev) return;

View File

@ -30,8 +30,8 @@ void ProcessMessageMasternodePayments(CNode* pfrom, std::string& strCommand, CDa
bool IsReferenceNode(CTxIn& vin);
bool IsBlockPayeeValid(const CTransaction& txNew, int nBlockHeight);
std::string GetRequiredPaymentsString(int nBlockHeight);
bool IsBlockValueValid(const CBlock& block, int64_t nExpectedValue);
void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees);
bool IsBlockValueValid(const CBlock& block, CAmount nExpectedValue);
void FillBlockPayee(CMutableTransaction& txNew, CAmount nFees);
void DumpMasternodePayments();
@ -268,7 +268,7 @@ public:
int GetMinMasternodePaymentsProto();
void ProcessMessageMasternodePayments(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
std::string GetRequiredPaymentsString(int nBlockHeight);
void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees);
void FillBlockPayee(CMutableTransaction& txNew, CAmount nFees);
std::string ToString() const;
int GetOldestBlock();
int GetNewestBlock();

View File

@ -119,7 +119,7 @@ bool fSucessfullyLoaded = false;
bool fEnableDarksend = false;
bool fDarksendMultiSession = false;
/** All denominations used by darksend */
std::vector<int64_t> darkSendDenominations;
std::vector<CAmount> darkSendDenominations;
string strBudgetMode = "";
map<string, string> mapArgs;

View File

@ -18,6 +18,7 @@
#include "compat.h"
#include "tinyformat.h"
#include "utiltime.h"
#include "amount.h"
#include <exception>
#include <map>
@ -43,7 +44,7 @@ extern int64_t enforceMasternodePaymentsTime;
extern std::string strMasterNodeAddr;
extern int keysLoaded;
extern bool fSucessfullyLoaded;
extern std::vector<int64_t> darkSendDenominations;
extern std::vector<CAmount> darkSendDenominations;
extern std::string strBudgetMode;
extern std::map<std::string, std::string> mapArgs;

View File

@ -954,9 +954,9 @@ bool CWallet::IsDenominated(const CTransaction& tx) const
}
bool CWallet::IsDenominatedAmount(int64_t nInputAmount) const
bool CWallet::IsDenominatedAmount(CAmount nInputAmount) const
{
BOOST_FOREACH(int64_t d, darkSendDenominations)
BOOST_FOREACH(CAmount d, darkSendDenominations)
if(nInputAmount == d)
return true;
return false;
@ -1592,7 +1592,7 @@ bool less_then_denom (const COutput& out1, const COutput& out2)
bool found1 = false;
bool found2 = false;
BOOST_FOREACH(int64_t d, darkSendDenominations) // loop through predefined denoms
BOOST_FOREACH(CAmount d, darkSendDenominations) // loop through predefined denoms
{
if(pcoin1->vout[out1.i].nValue == d) found1 = true;
if(pcoin2->vout[out2.i].nValue == d) found2 = true;
@ -1754,7 +1754,7 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
//if we're doing only denominated, we need to round up to the nearest .1DRK
if(coin_type == ONLY_DENOMINATED) {
// Make outputs by looping through denominations, from large to small
BOOST_FOREACH(int64_t v, darkSendDenominations)
BOOST_FOREACH(CAmount v, darkSendDenominations)
{
BOOST_FOREACH(const COutput& out, vCoins)
{
@ -1787,7 +1787,7 @@ struct CompareByPriority
}
};
bool CWallet::SelectCoinsByDenominations(int nDenom, int64_t nValueMin, int64_t nValueMax, std::vector<CTxIn>& vCoinsRet, std::vector<COutput>& vCoinsRet2, int64_t& nValueRet, int nDarksendRoundsMin, int nDarksendRoundsMax)
bool CWallet::SelectCoinsByDenominations(int nDenom, CAmount nValueMin, CAmount nValueMax, std::vector<CTxIn>& vCoinsRet, std::vector<COutput>& vCoinsRet2, CAmount& nValueRet, int nDarksendRoundsMin, int nDarksendRoundsMax)
{
vCoinsRet.clear();
nValueRet = 0;
@ -1906,7 +1906,7 @@ bool CWallet::SelectCoinsDark(CAmount nValueMin, CAmount nValueMax, std::vector<
return false;
}
bool CWallet::SelectCoinsCollateral(std::vector<CTxIn>& setCoinsRet, int64_t& nValueRet) const
bool CWallet::SelectCoinsCollateral(std::vector<CTxIn>& setCoinsRet, CAmount& nValueRet) const
{
vector<COutput> vCoins;
@ -1935,9 +1935,9 @@ bool CWallet::SelectCoinsCollateral(std::vector<CTxIn>& setCoinsRet, int64_t& nV
return false;
}
int CWallet::CountInputsWithAmount(int64_t nInputAmount)
int CWallet::CountInputsWithAmount(CAmount nInputAmount)
{
int64_t nTotal = 0;
CAmount nTotal = 0;
{
LOCK(cs_wallet);
for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
@ -1975,7 +1975,7 @@ bool CWallet::HasCollateralInputs(bool fOnlyConfirmed) const
return nFound > 0;
}
bool CWallet::IsCollateralAmount(int64_t nInputAmount) const
bool CWallet::IsCollateralAmount(CAmount nInputAmount) const
{
return nInputAmount != 0 && nInputAmount % DARKSEND_COLLATERAL == 0 && nInputAmount < DARKSEND_COLLATERAL * 5 && nInputAmount > DARKSEND_COLLATERAL;
}
@ -2050,9 +2050,9 @@ bool CWallet::GetBudgetSystemCollateralTX(CWalletTx& tx, uint256 hash, bool useI
CScript scriptChange;
scriptChange << OP_RETURN << ToByteVector(hash);
int64_t nFeeRet = 0;
CAmount nFeeRet = 0;
std::string strFail = "";
vector< pair<CScript, int64_t> > vecSend;
vector< pair<CScript, CAmount> > vecSend;
vecSend.push_back(make_pair(scriptChange, BUDGET_FEE_TX));
CCoinControl *coinControl=NULL;
@ -2066,7 +2066,7 @@ bool CWallet::GetBudgetSystemCollateralTX(CWalletTx& tx, uint256 hash, bool useI
}
bool CWallet::ConvertList(std::vector<CTxIn> vCoins, std::vector<int64_t>& vecAmounts)
bool CWallet::ConvertList(std::vector<CTxIn> vCoins, std::vector<CAmount>& vecAmounts)
{
BOOST_FOREACH(CTxIn i, vCoins){
if (mapWallet.count(i.prevout.hash))
@ -2380,8 +2380,8 @@ CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarge
return nFeeNeeded;
}
int64_t CWallet::GetTotalValue(std::vector<CTxIn> vCoins) {
int64_t nTotalValue = 0;
CAmount CWallet::GetTotalValue(std::vector<CTxIn> vCoins) {
CAmount nTotalValue = 0;
CWalletTx wtx;
BOOST_FOREACH(CTxIn i, vCoins){
if (mapWallet.count(i.prevout.hash))
@ -2410,7 +2410,7 @@ string CWallet::PrepareDarksendDenominate(int minRounds, int maxRounds)
std::vector<CTxIn> vCoins;
std::vector<CTxIn> vCoinsResult;
std::vector<COutput> vCoins2;
int64_t nValueIn = 0;
CAmount nValueIn = 0;
CReserveKey reservekey(this);
/*
@ -2431,7 +2431,7 @@ string CWallet::PrepareDarksendDenominate(int minRounds, int maxRounds)
LockCoin(v.prevout);
}
int64_t nValueLeft = nValueIn;
CAmount nValueLeft = nValueIn;
std::vector<CTxOut> vOut;
/*
@ -2446,7 +2446,7 @@ string CWallet::PrepareDarksendDenominate(int minRounds, int maxRounds)
int nStepsMax = 5 + GetRandInt(5);
while(nStep < nStepsMax) {
BOOST_FOREACH(int64_t v, darkSendDenominations){
BOOST_FOREACH(CAmount v, darkSendDenominations){
// only use the ones that are approved
bool fAccepted = false;
if((darkSendPool.sessionDenom & (1 << 0)) && v == ((100*COIN) +100000)) {fAccepted = true;}

View File

@ -150,14 +150,14 @@ private:
public:
// bool SelectCoins(int64_t nTargetValue, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64_t& nValueRet, const CCoinControl *coinControl = NULL, AvailableCoinsType coin_type=ALL_COINS, bool useIX = true) const;
bool SelectCoinsDark(int64_t nValueMin, int64_t nValueMax, std::vector<CTxIn>& setCoinsRet, int64_t& nValueRet, int nDarksendRoundsMin, int nDarksendRoundsMax) const;
bool SelectCoinsByDenominations(int nDenom, int64_t nValueMin, int64_t nValueMax, std::vector<CTxIn>& vCoinsRet, std::vector<COutput>& vCoinsRet2, int64_t& nValueRet, int nDarksendRoundsMin, int nDarksendRoundsMax);
bool SelectCoinsDarkDenominated(int64_t nTargetValue, std::vector<CTxIn>& setCoinsRet, int64_t& nValueRet) const;
bool SelectCoinsDark(CAmount nValueMin, CAmount nValueMax, std::vector<CTxIn>& setCoinsRet, CAmount& nValueRet, int nDarksendRoundsMin, int nDarksendRoundsMax) const;
bool SelectCoinsByDenominations(int nDenom, CAmount nValueMin, CAmount nValueMax, std::vector<CTxIn>& vCoinsRet, std::vector<COutput>& vCoinsRet2, CAmount& nValueRet, int nDarksendRoundsMin, int nDarksendRoundsMax);
bool SelectCoinsDarkDenominated(CAmount nTargetValue, std::vector<CTxIn>& setCoinsRet, CAmount& nValueRet) const;
bool HasCollateralInputs(bool fOnlyConfirmed = true) const;
bool IsCollateralAmount(int64_t nInputAmount) const;
int CountInputsWithAmount(int64_t nInputAmount);
bool IsCollateralAmount(CAmount nInputAmount) const;
int CountInputsWithAmount(CAmount nInputAmount);
bool SelectCoinsCollateral(std::vector<CTxIn>& setCoinsRet, int64_t& nValueRet) const ;
bool SelectCoinsCollateral(std::vector<CTxIn>& setCoinsRet, CAmount& nValueRet) const ;
/*
* Main wallet lock.
@ -239,7 +239,7 @@ public:
void UnlockCoin(COutPoint& output);
void UnlockAllCoins();
void ListLockedCoins(std::vector<COutPoint>& vOutpts);
int64_t GetTotalValue(std::vector<CTxIn> vCoins);
CAmount GetTotalValue(std::vector<CTxIn> vCoins);
/**
* keystore implementation
@ -326,7 +326,7 @@ public:
std::string PrepareDarksendDenominate(int minRounds, int maxRounds);
int GenerateDarksendOutputs(int nTotalValue, std::vector<CTxOut>& vout);
bool CreateCollateralTransaction(CMutableTransaction& txCollateral, std::string& strReason);
bool ConvertList(std::vector<CTxIn> vCoins, std::vector<int64_t>& vecAmounts);
bool ConvertList(std::vector<CTxIn> vCoins, std::vector<CAmount>& vecAmounts);
static CFeeRate minTxFee;
static CAmount GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool);
@ -356,7 +356,7 @@ public:
bool IsDenominated(const CTxIn &txin) const;
bool IsDenominated(const CTransaction& tx) const;
bool IsDenominatedAmount(int64_t nInputAmount) const;
bool IsDenominatedAmount(CAmount nInputAmount) const;
isminetype IsMine(const CTxIn& txin) const;
CAmount GetDebit(const CTxIn& txin, const isminefilter& filter) const;
@ -811,7 +811,7 @@ public:
if (IsCoinBase() && GetBlocksToMaturity() > 0)
return 0;
int64_t credit = 0;
CAmount credit = 0;
if (filter & ISMINE_SPENDABLE)
{
// GetBalance can assume transactions in mapWallet won't change
@ -1119,7 +1119,7 @@ public:
//Used with Darksend. Will return largest nondenom, then denominations, then very small inputs
int Priority() const
{
BOOST_FOREACH(int64_t d, darkSendDenominations)
BOOST_FOREACH(CAmount d, darkSendDenominations)
if(tx->vout[i].nValue == d) return 10000;
if(tx->vout[i].nValue < 1*COIN) return 20000;