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
12 changes: 6 additions & 6 deletions src/activemasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ bool CActiveMasternode::SendMasternodePing(std::string& errorMessage)
}

pmn->lastPing = mnp;
mnodeman.mapSeenMasternodePing.insert(make_pair(mnp.GetHash(), mnp));
mnodeman.mapSeenMasternodePing.insert(std::make_pair(mnp.GetHash(), mnp));

//mnodeman.mapSeenMasternodeBroadcast.lastPing is probably outdated, so we'll update it
CMasternodeBroadcast mnb(*pmn);
Expand Down Expand Up @@ -350,7 +350,7 @@ bool CActiveMasternode::GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secr
TRY_LOCK(pwalletMain->cs_wallet, fWallet);
if (!fWallet) return false;

vector<COutput> possibleCoins = SelectCoinsMasternode();
std::vector<COutput> possibleCoins = SelectCoinsMasternode();
COutput* selectedOutput;

// Find the vin
Expand Down Expand Up @@ -423,11 +423,11 @@ bool CActiveMasternode::GetVinFromOutput(COutput out, CTxIn& vin, CPubKey& pubke
}

// get all possible outputs for running Masternode
vector<COutput> CActiveMasternode::SelectCoinsMasternode()
std::vector<COutput> CActiveMasternode::SelectCoinsMasternode()
{
vector<COutput> vCoins;
vector<COutput> filteredCoins;
vector<COutPoint> confLockedCoins;
std::vector<COutput> vCoins;
std::vector<COutput> filteredCoins;
std::vector<COutPoint> confLockedCoins;

// Temporary unlock MN coins from masternode.conf
if (GetBoolArg("-mnconflock", true)) {
Expand Down
2 changes: 1 addition & 1 deletion src/activemasternode.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class CActiveMasternode

/// Get 10000 PIV input that can be used for the Masternode
bool GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secretKey);
vector<COutput> SelectCoinsMasternode();
std::vector<COutput> SelectCoinsMasternode();

/// Enable cold wallet mode (run a Masternode with no funds)
bool EnableHotColdMasterNode(CTxIn& vin, CService& addr);
Expand Down
7 changes: 3 additions & 4 deletions src/addrman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "serialize.h"
#include "streams.h"

using namespace std;

int CAddrInfo::GetTriedBucket(const uint256& nKey) const
{
Expand Down Expand Up @@ -70,7 +69,7 @@ double CAddrInfo::GetChance(int64_t nNow) const
fChance *= 0.01;

// deprioritize 66% after each failed attempt, but at most 1/28th to avoid the search taking forever or overly penalizing outages.
fChance *= pow(0.66, min(nAttempts, 8));
fChance *= pow(0.66, std::min(nAttempts, 8));

return fChance;
}
Expand Down Expand Up @@ -260,7 +259,7 @@ bool CAddrMan::Add_(const CAddress& addr, const CNetAddr& source, int64_t nTimeP
bool fCurrentlyOnline = (GetAdjustedTime() - addr.nTime < 24 * 60 * 60);
int64_t nUpdateInterval = (fCurrentlyOnline ? 60 * 60 : 24 * 60 * 60);
if (addr.nTime && (!pinfo->nTime || pinfo->nTime < addr.nTime - nUpdateInterval - nTimePenalty))
pinfo->nTime = max((int64_t)0, addr.nTime - nTimePenalty);
pinfo->nTime = std::max((int64_t)0, addr.nTime - nTimePenalty);

// add services
pinfo->nServices |= addr.nServices;
Expand All @@ -285,7 +284,7 @@ bool CAddrMan::Add_(const CAddress& addr, const CNetAddr& source, int64_t nTimeP
return false;
} else {
pinfo = Create(addr, source, &nId);
pinfo->nTime = max((int64_t)0, (int64_t)pinfo->nTime - nTimePenalty);
pinfo->nTime = std::max((int64_t)0, (int64_t)pinfo->nTime - nTimePenalty);
nNew++;
fNew = true;
}
Expand Down
9 changes: 4 additions & 5 deletions src/alert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
#include <boost/algorithm/string/replace.hpp>
#include <boost/thread.hpp>

using namespace std;

map<uint256, CAlert> mapAlerts;
std::map<uint256, CAlert> mapAlerts;
CCriticalSection cs_mapAlerts;

void CUnsignedAlert::SetNull()
Expand Down Expand Up @@ -160,7 +159,7 @@ CAlert CAlert::getAlertByHash(const uint256& hash)
CAlert retval;
{
LOCK(cs_mapAlerts);
map<uint256, CAlert>::iterator mi = mapAlerts.find(hash);
std::map<uint256, CAlert>::iterator mi = mapAlerts.find(hash);
if (mi != mapAlerts.end())
retval = mi->second;
}
Expand Down Expand Up @@ -197,7 +196,7 @@ bool CAlert::ProcessAlert(bool fThread)
{
LOCK(cs_mapAlerts);
// Cancel previous alerts
for (map<uint256, CAlert>::iterator mi = mapAlerts.begin(); mi != mapAlerts.end();) {
for (std::map<uint256, CAlert>::iterator mi = mapAlerts.begin(); mi != mapAlerts.end();) {
const CAlert& alert = (*mi).second;
if (Cancels(alert)) {
LogPrint("alert", "cancelling alert %d\n", alert.nID);
Expand All @@ -221,7 +220,7 @@ bool CAlert::ProcessAlert(bool fThread)
}

// Add to mapAlerts
mapAlerts.insert(make_pair(GetHash(), *this));
mapAlerts.insert(std::make_pair(GetHash(), *this));
// Notify UI and -alertnotify if it applies to me
if (AppliesToMe()) {
uiInterface.NotifyAlertChanged(GetHash(), CT_NEW);
Expand Down
2 changes: 1 addition & 1 deletion src/base58.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ std::string DecodeBase58(const char* psz)

for (unsigned int i = 0; i < vch.size(); i++) {
unsigned char* c = &vch[i];
ss << setw(2) << setfill('0') << (int)c[0];
ss << std::setw(2) << std::setfill('0') << (int)c[0];
}

return ss.str();
Expand Down
8 changes: 4 additions & 4 deletions src/bip38.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ bool ComputePasspoint(uint256 passfactor, CPubKey& passpoint)
void ComputeSeedBPass(CPubKey passpoint, std::string strAddressHash, std::string strOwnerSalt, uint512& seedBPass)
{
// Derive decryption key for seedb using scrypt with passpoint, addresshash, and ownerentropy
string salt = ReverseEndianString(strAddressHash + strOwnerSalt);
std::string salt = ReverseEndianString(strAddressHash + strOwnerSalt);
uint256 s2(salt);
scrypt_hash(BEGIN(passpoint), HexStr(passpoint).size() / 2, BEGIN(s2), salt.size() / 2, BEGIN(seedBPass), 1024, 1, 1, 64);
}
Expand All @@ -105,7 +105,7 @@ std::string AddressToBip38Hash(std::string address)

std::string BIP38_Encrypt(std::string strAddress, std::string strPassphrase, uint256 privKey, bool fCompressed)
{
string strAddressHash = AddressToBip38Hash(strAddress);
std::string strAddressHash = AddressToBip38Hash(strAddress);

uint512 hashed;
uint64_t salt = uint256(ReverseEndianString(strAddressHash)).Get64();
Expand All @@ -132,7 +132,7 @@ std::string BIP38_Encrypt(std::string strAddress, std::string strPassphrase, uin
uint512 encrypted2;
AES_encrypt(block2.begin(), encrypted2.begin(), &key);

string strPrefix = "0142";
std::string strPrefix = "0142";
strPrefix += (fCompressed ? "E0" : "C0");

uint512 encryptedKey(ReverseEndianString(strPrefix + strAddressHash));
Expand Down Expand Up @@ -273,7 +273,7 @@ bool BIP38_Decrypt(std::string strPassphrase, std::string strEncryptedKey, uint2
CKey k;
k.Set(privKey.begin(), privKey.end(), fCompressed);
CPubKey pubkey = k.GetPubKey();
string address = CBitcoinAddress(pubkey.GetID()).ToString();
std::string address = CBitcoinAddress(pubkey.GetID()).ToString();

return strAddressHash == AddressToBip38Hash(address);
}
33 changes: 16 additions & 17 deletions src/bloom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,22 @@
#define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455
#define LN2 0.6931471805599453094172321214581765680755001343602552

using namespace std;

CBloomFilter::CBloomFilter(unsigned int nElements, double nFPRate, unsigned int nTweakIn, unsigned char nFlagsIn) :
/**
/**
* The ideal size for a bloom filter with a given number of elements and false positive rate is:
* - nElements * log(fp rate) / ln(2)^2
* We ignore filter parameters which will create a bloom filter larger than the protocol limits
*/
vData(min((unsigned int)(-1 / LN2SQUARED * nElements * log(nFPRate)), MAX_BLOOM_FILTER_SIZE * 8) / 8),
vData(std::min((unsigned int)(-1 / LN2SQUARED * nElements * log(nFPRate)), MAX_BLOOM_FILTER_SIZE * 8) / 8),
/**
* The ideal number of hash functions is filter size * ln(2) / number of elements
* Again, we ignore filter parameters which will create a bloom filter with more hash functions than the protocol limits
* See https://en.wikipedia.org/wiki/Bloom_filter for an explanation of these formulas
*/
isFull(false),
isEmpty(false),
nHashFuncs(min((unsigned int)(vData.size() * 8 / nElements * LN2), MAX_HASH_FUNCS)),
isFull(false),
isEmpty(false),
nHashFuncs(std::min((unsigned int)(vData.size() * 8 / nElements * LN2), MAX_HASH_FUNCS)),
nTweak(nTweakIn),
nFlags(nFlagsIn)
{
Expand All @@ -55,7 +54,7 @@ void CBloomFilter::setNotFull()
isFull = false;
}

void CBloomFilter::insert(const vector<unsigned char>& vKey)
void CBloomFilter::insert(const std::vector<unsigned char>& vKey)
{
if (isFull)
return;
Expand All @@ -71,17 +70,17 @@ void CBloomFilter::insert(const COutPoint& outpoint)
{
CDataStream stream(SER_NETWORK, PROTOCOL_VERSION);
stream << outpoint;
vector<unsigned char> data(stream.begin(), stream.end());
std::vector<unsigned char> data(stream.begin(), stream.end());
insert(data);
}

void CBloomFilter::insert(const uint256& hash)
{
vector<unsigned char> data(hash.begin(), hash.end());
std::vector<unsigned char> data(hash.begin(), hash.end());
insert(data);
}

bool CBloomFilter::contains(const vector<unsigned char>& vKey) const
bool CBloomFilter::contains(const std::vector<unsigned char>& vKey) const
{
if (isFull) {
return true;
Expand All @@ -102,13 +101,13 @@ bool CBloomFilter::contains(const COutPoint& outpoint) const
{
CDataStream stream(SER_NETWORK, PROTOCOL_VERSION);
stream << outpoint;
vector<unsigned char> data(stream.begin(), stream.end());
std::vector<unsigned char> data(stream.begin(), stream.end());
return contains(data);
}

bool CBloomFilter::contains(const uint256& hash) const
{
vector<unsigned char> data(hash.begin(), hash.end());
std::vector<unsigned char> data(hash.begin(), hash.end());
return contains(data);
}

Expand Down Expand Up @@ -176,15 +175,15 @@ bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx)
// This means clients don't have to update the filter themselves when a new relevant tx
// is discovered in order to find spending transactions, which avoids round-tripping and race conditions.
CScript::const_iterator pc = txout.scriptPubKey.begin();
vector<unsigned char> data;
std::vector<unsigned char> data;
while (pc < txout.scriptPubKey.end()) {
opcodetype opcode;
if (!txout.scriptPubKey.GetOp(pc, opcode, data)){
break;
}

if (txout.IsZerocoinMint()){
data = vector<unsigned char>(txout.scriptPubKey.begin() + 6, txout.scriptPubKey.begin() + txout.scriptPubKey.size());
data = std::vector<unsigned char>(txout.scriptPubKey.begin() + 6, txout.scriptPubKey.begin() + txout.scriptPubKey.size());
}

if (data.size() != 0 && contains(data)) {
Expand All @@ -193,7 +192,7 @@ bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx)
insert(COutPoint(hash, i));
else if ((nFlags & BLOOM_UPDATE_MASK) == BLOOM_UPDATE_P2PUBKEY_ONLY) {
txnouttype type;
vector<vector<unsigned char> > vSolutions;
std::vector<std::vector<unsigned char> > vSolutions;
if (Solver(txout.scriptPubKey, type, vSolutions) &&
(type == TX_PUBKEY || type == TX_MULTISIG))
insert(COutPoint(hash, i));
Expand All @@ -213,13 +212,13 @@ bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx)

// Match if the filter contains any arbitrary script data element in any scriptSig in tx
CScript::const_iterator pc = txin.scriptSig.begin();
vector<unsigned char> data;
std::vector<unsigned char> data;
while (pc < txin.scriptSig.end()) {
opcodetype opcode;
if (!txin.scriptSig.GetOp(pc, opcode, data))
break;
if (txin.IsZerocoinSpend()) {
CDataStream s(vector<unsigned char>(txin.scriptSig.begin() + 44, txin.scriptSig.end()),
CDataStream s(std::vector<unsigned char>(txin.scriptSig.begin() + 44, txin.scriptSig.end()),
SER_NETWORK, PROTOCOL_VERSION);

data = libzerocoin::CoinSpend::ParseSerial(s);
Expand Down
1 change: 0 additions & 1 deletion src/chain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include "chain.h"

using namespace std;

/**
* CChain implementation
Expand Down
2 changes: 1 addition & 1 deletion src/chain.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class CBlockIndex
nAccumulatorCheckpoint = 0;
// Start supply of each denomination with 0s
for (auto& denom : libzerocoin::zerocoinDenomList) {
mapZerocoinSupply.insert(make_pair(denom, 0));
mapZerocoinSupply.insert(std::make_pair(denom, 0));
}
vMintDenominationsInBlock.clear();
}
Expand Down
4 changes: 1 addition & 3 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

#include <boost/assign/list_of.hpp>

using namespace std;
using namespace boost::assign;

struct SeedSpec6 {
uint8_t addr[16];
Expand Down Expand Up @@ -186,7 +184,7 @@ class CMainParams : public CChainParams
CMutableTransaction txNew;
txNew.vin.resize(1);
txNew.vout.resize(1);
txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
txNew.vout[0].nValue = 250 * COIN;
txNew.vout[0].scriptPubKey = CScript() << ParseHex("04c10e83b2703ccf322f7dbd62dd5855ac7c10bd055814ce121ba32607d573b8810c02c0582aed05b4deb9c4b77b26d92428c61256cd42774babea0a073b2ed0c9") << OP_CHECKSIG;
genesis.vtx.push_back(txNew);
Expand Down
1 change: 0 additions & 1 deletion src/chainparamsbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <boost/assign/list_of.hpp>

using namespace boost::assign;

/**
* Main network
Expand Down
Loading