Change internal references of Darksend to PrivateSend (#2372)

* Change all references to darksend to privatesend

* comment references to darksend
This commit is contained in:
PastaPastaPasta 2018-10-25 09:31:32 -05:00 committed by UdjinM6
parent e3df910822
commit 59932401bb
11 changed files with 99 additions and 99 deletions

View File

@ -94,7 +94,7 @@ public:
std::map<uint256, CMasternodePing> mapSeenMasternodePing;
// Keep track of all verifications I've seen
std::map<uint256, CMasternodeVerification> mapSeenMasternodeVerification;
// keep track of dsq count to prevent masternodes from gaming darksend queue
// keep track of dsq count to prevent masternodes from gaming privatesend queue
int64_t nDsqCount;

View File

@ -1224,7 +1224,7 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
}
if (!push && inv.type == MSG_DSTX) {
CDarksendBroadcastTx dstx = CPrivateSend::GetDSTX(inv.hash);
CPrivateSendBroadcastTx dstx = CPrivateSend::GetDSTX(inv.hash);
if(dstx) {
connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::DSTX, dstx));
push = true;
@ -1940,7 +1940,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
std::vector<uint256> vEraseQueue;
CTransactionRef ptx;
CTxLockRequest txLockRequest;
CDarksendBroadcastTx dstx;
CPrivateSendBroadcastTx dstx;
int nInvType = MSG_TX;
bool fCanAutoLock = false;

View File

@ -41,7 +41,7 @@ void CPrivateSendClientManager::ProcessMessage(CNode* pfrom, const std::string&
return;
}
CDarksendQueue dsq;
CPrivateSendQueue dsq;
vRecv >> dsq;
{
@ -49,7 +49,7 @@ void CPrivateSendClientManager::ProcessMessage(CNode* pfrom, const std::string&
if(!lockRecv) return;
// process every dsq only once
for (const auto& q : vecDarksendQueue) {
for (const auto& q : vecPrivateSendQueue) {
if(q == dsq) {
// LogPrint("privatesend", "DSQUEUE -- %s seen\n", dsq.ToString());
return;
@ -86,7 +86,7 @@ void CPrivateSendClientManager::ProcessMessage(CNode* pfrom, const std::string&
TRY_LOCK(cs_vecqueue, lockRecv);
if(!lockRecv) return;
for (const auto& q : vecDarksendQueue) {
for (const auto& q : vecPrivateSendQueue) {
if(q.masternodeOutpoint == dsq.masternodeOutpoint) {
// no way same mn can send another "not yet ready" dsq this soon
LogPrint("privatesend", "DSQUEUE -- Masternode %s is sending WAY too many dsq messages\n", infoMn.addr.ToString());
@ -111,7 +111,7 @@ void CPrivateSendClientManager::ProcessMessage(CNode* pfrom, const std::string&
dsq.fTried = true;
}
}
vecDarksendQueue.push_back(dsq);
vecPrivateSendQueue.push_back(dsq);
dsq.Relay(connman);
}
@ -819,7 +819,7 @@ bool CPrivateSendClientSession::DoAutomaticDenominating(CConnman& connman, bool
return false;
}
TRY_LOCK(cs_darksend, lockDS);
TRY_LOCK(cs_privatesend, lockDS);
if(!lockDS) {
strAutoDenomResult = _("Lock is already in place.");
return false;
@ -994,7 +994,7 @@ bool CPrivateSendClientSession::JoinExistingQueue(CAmount nBalanceNeedsAnonymize
std::vector<CAmount> vecStandardDenoms = CPrivateSend::GetStandardDenominations();
// Look through the queues and see if anything matches
CDarksendQueue dsq;
CPrivateSendQueue dsq;
while (privateSendClient.GetQueueItemAndTry(dsq)) {
masternode_info_t infoMn;
@ -1018,7 +1018,7 @@ bool CPrivateSendClientSession::JoinExistingQueue(CAmount nBalanceNeedsAnonymize
}
// mixing rate limit i.e. nLastDsq check should already pass in DSQUEUE ProcessMessage
// in order for dsq to get into vecDarksendQueue, so we should be safe to mix already,
// in order for dsq to get into vecPrivateSendQueue, so we should be safe to mix already,
// no need for additional verification here
LogPrint("privatesend", "CPrivateSendClientSession::JoinExistingQueue -- found valid queue: %s\n", dsq.ToString());
@ -1042,7 +1042,7 @@ bool CPrivateSendClientSession::JoinExistingQueue(CAmount nBalanceNeedsAnonymize
nSessionDenom = dsq.nDenom;
infoMixingMasternode = infoMn;
pendingDsaRequest = CPendingDsaRequest(infoMn.addr, CDarksendAccept(nSessionDenom, txMyCollateral));
pendingDsaRequest = CPendingDsaRequest(infoMn.addr, CPrivateSendAccept(nSessionDenom, txMyCollateral));
connman.AddPendingMasternode(infoMn.addr);
// TODO: add new state POOL_STATE_CONNECTING and bump MIN_PRIVATESEND_PEER_PROTO_VERSION
SetState(POOL_STATE_QUEUE);
@ -1066,7 +1066,7 @@ bool CPrivateSendClientSession::StartNewQueue(CAmount nValueMin, CAmount nBalanc
// ** find the coins we'll use
std::vector<CTxIn> vecTxIn;
CAmount nValueInTmp = 0;
if(!pwalletMain->SelectCoinsDark(nValueMin, nBalanceNeedsAnonymized, vecTxIn, nValueInTmp, 0, privateSendClient.nPrivateSendRounds - 1)) {
if(!pwalletMain->SelectPrivateCoins(nValueMin, nBalanceNeedsAnonymized, vecTxIn, nValueInTmp, 0, privateSendClient.nPrivateSendRounds - 1)) {
// this should never happen
LogPrintf("CPrivateSendClientSession::StartNewQueue -- Can't mix: no compatible inputs found!\n");
strAutoDenomResult = _("Can't mix: no compatible inputs found!");
@ -1118,7 +1118,7 @@ bool CPrivateSendClientSession::StartNewQueue(CAmount nValueMin, CAmount nBalanc
infoMixingMasternode = infoMn;
connman.AddPendingMasternode(infoMn.addr);
pendingDsaRequest = CPendingDsaRequest(infoMn.addr, CDarksendAccept(nSessionDenom, txMyCollateral));
pendingDsaRequest = CPendingDsaRequest(infoMn.addr, CPrivateSendAccept(nSessionDenom, txMyCollateral));
// TODO: add new state POOL_STATE_CONNECTING and bump MIN_PRIVATESEND_PEER_PROTO_VERSION
SetState(POOL_STATE_QUEUE);
nTimeLastSuccessfulStep = GetTime();
@ -1573,7 +1573,7 @@ bool CPrivateSendClientSession::CreateDenominated(const CompactTallyItem& tallyI
return true;
}
void CPrivateSendClientSession::RelayIn(const CDarkSendEntry& entry, CConnman& connman)
void CPrivateSendClientSession::RelayIn(const CPrivateSendEntry& entry, CConnman& connman)
{
if(!infoMixingMasternode.fInfoValid) return;

View File

@ -45,24 +45,24 @@ private:
static const int TIMEOUT = 15;
CService addr;
CDarksendAccept dsa;
CPrivateSendAccept dsa;
int64_t nTimeCreated;
public:
CPendingDsaRequest():
addr(CService()),
dsa(CDarksendAccept()),
dsa(CPrivateSendAccept()),
nTimeCreated(0)
{}
CPendingDsaRequest(const CService& addr_, const CDarksendAccept& dsa_):
CPendingDsaRequest(const CService& addr_, const CPrivateSendAccept& dsa_):
addr(addr_),
dsa(dsa_),
nTimeCreated(GetTime())
{}
CService GetAddr() { return addr; }
CDarksendAccept GetDSA() { return dsa; }
CPrivateSendAccept GetDSA() { return dsa; }
bool IsExpired() { return GetTime() - nTimeCreated > TIMEOUT; }
friend bool operator==(const CPendingDsaRequest& a, const CPendingDsaRequest& b)
@ -126,7 +126,7 @@ private:
/// As a client, check and sign the final transaction
bool SignFinalTransaction(const CTransaction& finalTransactionNew, CNode* pnode, CConnman& connman);
void RelayIn(const CDarkSendEntry& entry, CConnman& connman);
void RelayIn(const CPrivateSendEntry& entry, CConnman& connman);
void SetNull();

View File

@ -40,7 +40,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm
return;
}
CDarksendAccept dsa;
CPrivateSendAccept dsa;
vRecv >> dsa;
LogPrint("privatesend", "DSACCEPT -- nDenom %d (%s) txCollateral %s", dsa.nDenom, CPrivateSend::GetDenominationsToString(dsa.nDenom), dsa.txCollateral.ToString());
@ -84,11 +84,11 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm
return;
}
CDarksendQueue dsq;
CPrivateSendQueue dsq;
vRecv >> dsq;
// process every dsq only once
for (const auto& q : vecDarksendQueue) {
for (const auto& q : vecPrivateSendQueue) {
if(q == dsq) {
// LogPrint("privatesend", "DSQUEUE -- %s seen\n", dsq.ToString());
return;
@ -109,7 +109,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm
}
if(!dsq.fReady) {
for (const auto& q : vecDarksendQueue) {
for (const auto& q : vecPrivateSendQueue) {
if(q.masternodeOutpoint == dsq.masternodeOutpoint) {
// no way same mn can send another "not yet ready" dsq this soon
LogPrint("privatesend", "DSQUEUE -- Masternode %s is sending WAY too many dsq messages\n", mnInfo.addr.ToString());
@ -127,7 +127,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm
mnodeman.AllowMixing(dsq.masternodeOutpoint);
LogPrint("privatesend", "DSQUEUE -- new PrivateSend queue (%s) from masternode %s\n", dsq.ToString(), mnInfo.addr.ToString());
vecDarksendQueue.push_back(dsq);
vecPrivateSendQueue.push_back(dsq);
dsq.Relay(connman);
}
@ -148,7 +148,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm
return;
}
CDarkSendEntry entry;
CPrivateSendEntry entry;
vRecv >> entry;
LogPrint("privatesend", "DSVIN -- txCollateral %s", entry.txCollateral->ToString());
@ -349,7 +349,7 @@ void CPrivateSendServer::CommitFinalTransaction(CConnman& connman)
// create and sign masternode dstx transaction
if(!CPrivateSend::GetDSTX(hashTx)) {
CDarksendBroadcastTx dstxNew(finalTransaction, activeMasternodeInfo.outpoint, GetAdjustedTime());
CPrivateSendBroadcastTx dstxNew(finalTransaction, activeMasternodeInfo.outpoint, GetAdjustedTime());
dstxNew.Sign();
CPrivateSend::AddDSTX(dstxNew);
}
@ -510,7 +510,7 @@ void CPrivateSendServer::CheckForCompleteQueue(CConnman& connman)
if(nState == POOL_STATE_QUEUE && IsSessionReady()) {
SetState(POOL_STATE_ACCEPTING_ENTRIES);
CDarksendQueue dsq(nSessionDenom, activeMasternodeInfo.outpoint, GetAdjustedTime(), true);
CPrivateSendQueue dsq(nSessionDenom, activeMasternodeInfo.outpoint, GetAdjustedTime(), true);
LogPrint("privatesend", "CPrivateSendServer::CheckForCompleteQueue -- queue is ready, signing and relaying (%s)\n", dsq.ToString());
dsq.Sign();
dsq.Relay(connman);
@ -563,7 +563,7 @@ bool CPrivateSendServer::IsInputScriptSigValid(const CTxIn& txin)
//
// Add a clients transaction to the pool
//
bool CPrivateSendServer::AddEntry(const CDarkSendEntry& entryNew, PoolMessage& nMessageIDRet)
bool CPrivateSendServer::AddEntry(const CPrivateSendEntry& entryNew, PoolMessage& nMessageIDRet)
{
if(!fMasternodeMode) return false;
@ -669,7 +669,7 @@ bool CPrivateSendServer::IsOutputsCompatibleWithSessionDenom(const std::vector<C
return true;
}
bool CPrivateSendServer::IsAcceptableDSA(const CDarksendAccept& dsa, PoolMessage& nMessageIDRet)
bool CPrivateSendServer::IsAcceptableDSA(const CPrivateSendAccept& dsa, PoolMessage& nMessageIDRet)
{
if(!fMasternodeMode) return false;
@ -691,7 +691,7 @@ bool CPrivateSendServer::IsAcceptableDSA(const CDarksendAccept& dsa, PoolMessage
return true;
}
bool CPrivateSendServer::CreateNewSession(const CDarksendAccept& dsa, PoolMessage& nMessageIDRet, CConnman& connman)
bool CPrivateSendServer::CreateNewSession(const CPrivateSendAccept& dsa, PoolMessage& nMessageIDRet, CConnman& connman)
{
if(!fMasternodeMode || nSessionID != 0) return false;
@ -716,11 +716,11 @@ bool CPrivateSendServer::CreateNewSession(const CDarksendAccept& dsa, PoolMessag
if(!fUnitTest) {
//broadcast that I'm accepting entries, only if it's the first entry through
CDarksendQueue dsq(nSessionDenom, activeMasternodeInfo.outpoint, GetAdjustedTime(), false);
CPrivateSendQueue dsq(nSessionDenom, activeMasternodeInfo.outpoint, GetAdjustedTime(), false);
LogPrint("privatesend", "CPrivateSendServer::CreateNewSession -- signing and relaying new queue: %s\n", dsq.ToString());
dsq.Sign();
dsq.Relay(connman);
vecDarksendQueue.push_back(dsq);
vecPrivateSendQueue.push_back(dsq);
}
vecSessionCollaterals.push_back(MakeTransactionRef(dsa.txCollateral));
@ -730,7 +730,7 @@ bool CPrivateSendServer::CreateNewSession(const CDarksendAccept& dsa, PoolMessag
return true;
}
bool CPrivateSendServer::AddUserToExistingSession(const CDarksendAccept& dsa, PoolMessage& nMessageIDRet)
bool CPrivateSendServer::AddUserToExistingSession(const CPrivateSendAccept& dsa, PoolMessage& nMessageIDRet)
{
if(!fMasternodeMode || nSessionID == 0 || IsSessionReady()) return false;

View File

@ -25,7 +25,7 @@ private:
bool fUnitTest;
/// Add a clients entry to the pool
bool AddEntry(const CDarkSendEntry& entryNew, PoolMessage& nMessageIDRet);
bool AddEntry(const CPrivateSendEntry& entryNew, PoolMessage& nMessageIDRet);
/// Add signature to a txin
bool AddScriptSig(const CTxIn& txin);
@ -41,9 +41,9 @@ private:
void CommitFinalTransaction(CConnman& connman);
/// Is this nDenom and txCollateral acceptable?
bool IsAcceptableDSA(const CDarksendAccept& dsa, PoolMessage &nMessageIDRet);
bool CreateNewSession(const CDarksendAccept& dsa, PoolMessage &nMessageIDRet, CConnman& connman);
bool AddUserToExistingSession(const CDarksendAccept& dsa, PoolMessage &nMessageIDRet);
bool IsAcceptableDSA(const CPrivateSendAccept& dsa, PoolMessage &nMessageIDRet);
bool CreateNewSession(const CPrivateSendAccept& dsa, PoolMessage &nMessageIDRet, CConnman& connman);
bool AddUserToExistingSession(const CPrivateSendAccept& dsa, PoolMessage &nMessageIDRet);
/// Do we have enough users to take entries?
bool IsSessionReady() { return (int)vecSessionCollaterals.size() >= CPrivateSend::GetMaxPoolTransactions(); }

View File

@ -17,7 +17,7 @@
#include <string>
bool CDarkSendEntry::AddScriptSig(const CTxIn& txin)
bool CPrivateSendEntry::AddScriptSig(const CTxIn& txin)
{
for (auto& txdsin : vecTxDSIn) {
if(txdsin.prevout == txin.prevout && txdsin.nSequence == txin.nSequence) {
@ -33,7 +33,7 @@ bool CDarkSendEntry::AddScriptSig(const CTxIn& txin)
return false;
}
uint256 CDarksendQueue::GetSignatureHash() const
uint256 CPrivateSendQueue::GetSignatureHash() const
{
// Remove after migration to 70211
{
@ -45,7 +45,7 @@ uint256 CDarksendQueue::GetSignatureHash() const
// return SerializeHash(*this);
}
bool CDarksendQueue::Sign()
bool CPrivateSendQueue::Sign()
{
if(!fMasternodeMode) return false;
@ -59,12 +59,12 @@ bool CDarksendQueue::Sign()
uint256 hash = GetSignatureHash();
if (!CHashSigner::SignHash(hash, activeMasternodeInfo.legacyKeyOperator, vchSig)) {
LogPrintf("CDarksendQueue::Sign -- SignHash() failed\n");
LogPrintf("CPrivateSendQueue::Sign -- SignHash() failed\n");
return false;
}
if (!CHashSigner::VerifyHash(hash, activeMasternodeInfo.legacyKeyIDOperator, vchSig, strError)) {
LogPrintf("CDarksendQueue::Sign -- VerifyHash() failed, error: %s\n", strError);
LogPrintf("CPrivateSendQueue::Sign -- VerifyHash() failed, error: %s\n", strError);
return false;
}
} else {
@ -74,12 +74,12 @@ bool CDarksendQueue::Sign()
std::to_string(fReady);
if(!CMessageSigner::SignMessage(strMessage, vchSig, activeMasternodeInfo.legacyKeyOperator)) {
LogPrintf("CDarksendQueue::Sign -- SignMessage() failed, %s\n", ToString());
LogPrintf("CPrivateSendQueue::Sign -- SignMessage() failed, %s\n", ToString());
return false;
}
if(!CMessageSigner::VerifyMessage(activeMasternodeInfo.legacyKeyIDOperator, vchSig, strMessage, strError)) {
LogPrintf("CDarksendQueue::Sign -- VerifyMessage() failed, error: %s\n", strError);
LogPrintf("CPrivateSendQueue::Sign -- VerifyMessage() failed, error: %s\n", strError);
return false;
}
}
@ -87,7 +87,7 @@ bool CDarksendQueue::Sign()
return true;
}
bool CDarksendQueue::CheckSignature(const CKeyID& keyIDOperator, const CBLSPublicKey& blsPubKey) const
bool CPrivateSendQueue::CheckSignature(const CKeyID& keyIDOperator, const CBLSPublicKey& blsPubKey) const
{
std::string strError = "";
if (deterministicMNManager->IsDeterministicMNsSporkActive()) {
@ -104,7 +104,7 @@ bool CDarksendQueue::CheckSignature(const CKeyID& keyIDOperator, const CBLSPubli
if (!CHashSigner::VerifyHash(hash, keyIDOperator, vchSig, strError)) {
// we don't care about queues with old signature format
LogPrintf("CDarksendQueue::CheckSignature -- VerifyHash() failed, error: %s\n", strError);
LogPrintf("CPrivateSendQueue::CheckSignature -- VerifyHash() failed, error: %s\n", strError);
return false;
}
} else {
@ -114,7 +114,7 @@ bool CDarksendQueue::CheckSignature(const CKeyID& keyIDOperator, const CBLSPubli
std::to_string(fReady);
if(!CMessageSigner::VerifyMessage(keyIDOperator, vchSig, strMessage, strError)) {
LogPrintf("CDarksendQueue::CheckSignature -- Got bad Masternode queue signature: %s; error: %s\n", ToString(), strError);
LogPrintf("CPrivateSendQueue::CheckSignature -- Got bad Masternode queue signature: %s; error: %s\n", ToString(), strError);
return false;
}
}
@ -122,7 +122,7 @@ bool CDarksendQueue::CheckSignature(const CKeyID& keyIDOperator, const CBLSPubli
return true;
}
bool CDarksendQueue::Relay(CConnman& connman)
bool CPrivateSendQueue::Relay(CConnman& connman)
{
connman.ForEachNode([&connman, this](CNode* pnode) {
CNetMsgMaker msgMaker(pnode->GetSendVersion());
@ -132,12 +132,12 @@ bool CDarksendQueue::Relay(CConnman& connman)
return true;
}
uint256 CDarksendBroadcastTx::GetSignatureHash() const
uint256 CPrivateSendBroadcastTx::GetSignatureHash() const
{
return SerializeHash(*this);
}
bool CDarksendBroadcastTx::Sign()
bool CPrivateSendBroadcastTx::Sign()
{
if(!fMasternodeMode) return false;
@ -152,24 +152,24 @@ bool CDarksendBroadcastTx::Sign()
uint256 hash = GetSignatureHash();
if (!CHashSigner::SignHash(hash, activeMasternodeInfo.legacyKeyOperator, vchSig)) {
LogPrintf("CDarksendBroadcastTx::Sign -- SignHash() failed\n");
LogPrintf("CPrivateSendBroadcastTx::Sign -- SignHash() failed\n");
return false;
}
if (!CHashSigner::VerifyHash(hash, activeMasternodeInfo.legacyKeyIDOperator, vchSig, strError)) {
LogPrintf("CDarksendBroadcastTx::Sign -- VerifyHash() failed, error: %s\n", strError);
LogPrintf("CPrivateSendBroadcastTx::Sign -- VerifyHash() failed, error: %s\n", strError);
return false;
}
} else {
std::string strMessage = tx->GetHash().ToString() + std::to_string(sigTime);
if(!CMessageSigner::SignMessage(strMessage, vchSig, activeMasternodeInfo.legacyKeyOperator)) {
LogPrintf("CDarksendBroadcastTx::Sign -- SignMessage() failed\n");
LogPrintf("CPrivateSendBroadcastTx::Sign -- SignMessage() failed\n");
return false;
}
if(!CMessageSigner::VerifyMessage(activeMasternodeInfo.legacyKeyIDOperator, vchSig, strMessage, strError)) {
LogPrintf("CDarksendBroadcastTx::Sign -- VerifyMessage() failed, error: %s\n", strError);
LogPrintf("CPrivateSendBroadcastTx::Sign -- VerifyMessage() failed, error: %s\n", strError);
return false;
}
}
@ -177,7 +177,7 @@ bool CDarksendBroadcastTx::Sign()
return true;
}
bool CDarksendBroadcastTx::CheckSignature(const CKeyID& keyIDOperator, const CBLSPublicKey& blsPubKey) const
bool CPrivateSendBroadcastTx::CheckSignature(const CKeyID& keyIDOperator, const CBLSPublicKey& blsPubKey) const
{
std::string strError = "";
@ -195,14 +195,14 @@ bool CDarksendBroadcastTx::CheckSignature(const CKeyID& keyIDOperator, const CBL
if (!CHashSigner::VerifyHash(hash, keyIDOperator, vchSig, strError)) {
// we don't care about dstxes with old signature format
LogPrintf("CDarksendBroadcastTx::CheckSignature -- VerifyHash() failed, error: %s\n", strError);
LogPrintf("CPrivateSendBroadcastTx::CheckSignature -- VerifyHash() failed, error: %s\n", strError);
return false;
}
} else {
std::string strMessage = tx->GetHash().ToString() + std::to_string(sigTime);
if(!CMessageSigner::VerifyMessage(keyIDOperator, vchSig, strMessage, strError)) {
LogPrintf("CDarksendBroadcastTx::CheckSignature -- Got bad dstx signature, error: %s\n", strError);
LogPrintf("CPrivateSendBroadcastTx::CheckSignature -- Got bad dstx signature, error: %s\n", strError);
return false;
}
}
@ -210,7 +210,7 @@ bool CDarksendBroadcastTx::CheckSignature(const CKeyID& keyIDOperator, const CBL
return true;
}
bool CDarksendBroadcastTx::IsExpired(int nHeight)
bool CPrivateSendBroadcastTx::IsExpired(int nHeight)
{
// expire confirmed DSTXes after ~1h since confirmation
return (nConfirmedHeight != -1) && (nHeight - nConfirmedHeight > 24);
@ -219,7 +219,7 @@ bool CDarksendBroadcastTx::IsExpired(int nHeight)
void CPrivateSendBaseSession::SetNull()
{
// Both sides
LOCK(cs_darksend);
LOCK(cs_privatesend);
nState = POOL_STATE_IDLE;
nSessionID = 0;
nSessionDenom = 0;
@ -232,7 +232,7 @@ void CPrivateSendBaseSession::SetNull()
void CPrivateSendBaseManager::SetNull()
{
LOCK(cs_vecqueue);
vecDarksendQueue.clear();
vecPrivateSendQueue.clear();
}
void CPrivateSendBaseManager::CheckQueue()
@ -241,21 +241,21 @@ void CPrivateSendBaseManager::CheckQueue()
if(!lockDS) return; // it's ok to fail here, we run this quite frequently
// check mixing queue objects for timeouts
std::vector<CDarksendQueue>::iterator it = vecDarksendQueue.begin();
while(it != vecDarksendQueue.end()) {
std::vector<CPrivateSendQueue>::iterator it = vecPrivateSendQueue.begin();
while(it != vecPrivateSendQueue.end()) {
if((*it).IsExpired()) {
LogPrint("privatesend", "CPrivateSendBaseManager::%s -- Removing expired queue (%s)\n", __func__, (*it).ToString());
it = vecDarksendQueue.erase(it);
it = vecPrivateSendQueue.erase(it);
} else ++it;
}
}
bool CPrivateSendBaseManager::GetQueueItemAndTry(CDarksendQueue& dsqRet)
bool CPrivateSendBaseManager::GetQueueItemAndTry(CPrivateSendQueue& dsqRet)
{
TRY_LOCK(cs_vecqueue, lockDS);
if(!lockDS) return false; // it's ok to fail here, we run this quite frequently
for (auto& dsq : vecDarksendQueue) {
for (auto& dsq : vecPrivateSendQueue) {
// only try each queue once
if(dsq.fTried || dsq.IsExpired()) continue;
dsq.fTried = true;
@ -281,7 +281,7 @@ std::string CPrivateSendBaseSession::GetStateString() const
// Definitions for static data members
std::vector<CAmount> CPrivateSend::vecStandardDenominations;
std::map<uint256, CDarksendBroadcastTx> CPrivateSend::mapDSTX;
std::map<uint256, CPrivateSendBroadcastTx> CPrivateSend::mapDSTX;
CCriticalSection CPrivateSend::cs_mapdstx;
void CPrivateSend::InitStandardDenominations()
@ -513,23 +513,23 @@ std::string CPrivateSend::GetMessageByID(PoolMessage nMessageID)
}
}
void CPrivateSend::AddDSTX(const CDarksendBroadcastTx& dstx)
void CPrivateSend::AddDSTX(const CPrivateSendBroadcastTx& dstx)
{
LOCK(cs_mapdstx);
mapDSTX.insert(std::make_pair(dstx.tx->GetHash(), dstx));
}
CDarksendBroadcastTx CPrivateSend::GetDSTX(const uint256& hash)
CPrivateSendBroadcastTx CPrivateSend::GetDSTX(const uint256& hash)
{
LOCK(cs_mapdstx);
auto it = mapDSTX.find(hash);
return (it == mapDSTX.end()) ? CDarksendBroadcastTx() : it->second;
return (it == mapDSTX.end()) ? CPrivateSendBroadcastTx() : it->second;
}
void CPrivateSend::CheckDSTXes(int nHeight)
{
LOCK(cs_mapdstx);
std::map<uint256, CDarksendBroadcastTx>::iterator it = mapDSTX.begin();
std::map<uint256, CPrivateSendBroadcastTx>::iterator it = mapDSTX.begin();
while(it != mapDSTX.end()) {
if (it->second.IsExpired(nHeight)) {
mapDSTX.erase(it++);

View File

@ -96,18 +96,18 @@ public:
{}
};
class CDarksendAccept
class CPrivateSendAccept
{
public:
int nDenom;
CMutableTransaction txCollateral;
CDarksendAccept() :
CPrivateSendAccept() :
nDenom(0),
txCollateral(CMutableTransaction())
{};
CDarksendAccept(int nDenom, const CMutableTransaction& txCollateral) :
CPrivateSendAccept(int nDenom, const CMutableTransaction& txCollateral) :
nDenom(nDenom),
txCollateral(txCollateral)
{};
@ -125,14 +125,14 @@ public:
READWRITE(txCollateral);
}
friend bool operator==(const CDarksendAccept& a, const CDarksendAccept& b)
friend bool operator==(const CPrivateSendAccept& a, const CPrivateSendAccept& b)
{
return a.nDenom == b.nDenom && a.txCollateral == b.txCollateral;
}
};
// A clients transaction in the mixing pool
class CDarkSendEntry
class CPrivateSendEntry
{
public:
std::vector<CTxDSIn> vecTxDSIn;
@ -141,14 +141,14 @@ public:
// memory only
CService addr;
CDarkSendEntry() :
CPrivateSendEntry() :
vecTxDSIn(std::vector<CTxDSIn>()),
vecTxOut(std::vector<CTxOut>()),
txCollateral(MakeTransactionRef()),
addr(CService())
{}
CDarkSendEntry(const std::vector<CTxDSIn>& vecTxDSIn, const std::vector<CTxOut>& vecTxOut, const CTransaction& txCollateral) :
CPrivateSendEntry(const std::vector<CTxDSIn>& vecTxDSIn, const std::vector<CTxOut>& vecTxOut, const CTransaction& txCollateral) :
vecTxDSIn(vecTxDSIn),
vecTxOut(vecTxOut),
txCollateral(MakeTransactionRef(txCollateral)),
@ -171,7 +171,7 @@ public:
/**
* A currently in progress mixing merge and denomination information
*/
class CDarksendQueue
class CPrivateSendQueue
{
public:
int nDenom;
@ -183,7 +183,7 @@ public:
// memory only
bool fTried;
CDarksendQueue() :
CPrivateSendQueue() :
nDenom(0),
nInputCount(0),
masternodeOutpoint(COutPoint()),
@ -193,7 +193,7 @@ public:
fTried(false)
{}
CDarksendQueue(int nDenom, COutPoint outpoint, int64_t nTime, bool fReady) :
CPrivateSendQueue(int nDenom, COutPoint outpoint, int64_t nTime, bool fReady) :
nDenom(nDenom),
nInputCount(0),
masternodeOutpoint(outpoint),
@ -243,7 +243,7 @@ public:
nDenom, nTime, fReady ? "true" : "false", fTried ? "true" : "false", masternodeOutpoint.ToStringShort());
}
friend bool operator==(const CDarksendQueue& a, const CDarksendQueue& b)
friend bool operator==(const CPrivateSendQueue& a, const CPrivateSendQueue& b)
{
return a.nDenom == b.nDenom && a.masternodeOutpoint == b.masternodeOutpoint && a.nTime == b.nTime && a.fReady == b.fReady;
}
@ -251,7 +251,7 @@ public:
/** Helper class to store mixing transaction (tx) information.
*/
class CDarksendBroadcastTx
class CPrivateSendBroadcastTx
{
private:
// memory only
@ -264,7 +264,7 @@ public:
std::vector<unsigned char> vchSig;
int64_t sigTime;
CDarksendBroadcastTx() :
CPrivateSendBroadcastTx() :
nConfirmedHeight(-1),
tx(MakeTransactionRef()),
masternodeOutpoint(),
@ -272,7 +272,7 @@ public:
sigTime(0)
{}
CDarksendBroadcastTx(const CTransactionRef& _tx, COutPoint _outpoint, int64_t _sigTime) :
CPrivateSendBroadcastTx(const CTransactionRef& _tx, COutPoint _outpoint, int64_t _sigTime) :
nConfirmedHeight(-1),
tx(_tx),
masternodeOutpoint(_outpoint),
@ -292,17 +292,17 @@ public:
READWRITE(sigTime);
}
friend bool operator==(const CDarksendBroadcastTx& a, const CDarksendBroadcastTx& b)
friend bool operator==(const CPrivateSendBroadcastTx& a, const CPrivateSendBroadcastTx& b)
{
return *a.tx == *b.tx;
}
friend bool operator!=(const CDarksendBroadcastTx& a, const CDarksendBroadcastTx& b)
friend bool operator!=(const CPrivateSendBroadcastTx& a, const CPrivateSendBroadcastTx& b)
{
return !(a == b);
}
explicit operator bool() const
{
return *this != CDarksendBroadcastTx();
return *this != CPrivateSendBroadcastTx();
}
uint256 GetSignatureHash() const;
@ -318,9 +318,9 @@ public:
class CPrivateSendBaseSession
{
protected:
mutable CCriticalSection cs_darksend;
mutable CCriticalSection cs_privatesend;
std::vector<CDarkSendEntry> vecEntries; // Masternode/clients entries
std::vector<CPrivateSendEntry> vecEntries; // Masternode/clients entries
PoolState nState; // should be one of the POOL_STATE_XXX values
int64_t nTimeLastSuccessfulStep; // the time when last successful mixing step was performed
@ -356,16 +356,16 @@ protected:
mutable CCriticalSection cs_vecqueue;
// The current mixing sessions in progress on the network
std::vector<CDarksendQueue> vecDarksendQueue;
std::vector<CPrivateSendQueue> vecPrivateSendQueue;
void SetNull();
void CheckQueue();
public:
CPrivateSendBaseManager() : vecDarksendQueue() {}
CPrivateSendBaseManager() : vecPrivateSendQueue() {}
int GetQueueSize() const { return vecDarksendQueue.size(); }
bool GetQueueItemAndTry(CDarksendQueue& dsqRet);
int GetQueueSize() const { return vecPrivateSendQueue.size(); }
bool GetQueueItemAndTry(CPrivateSendQueue& dsqRet);
};
// helper class
@ -382,7 +382,7 @@ private:
// static members
static std::vector<CAmount> vecStandardDenominations;
static std::map<uint256, CDarksendBroadcastTx> mapDSTX;
static std::map<uint256, CPrivateSendBroadcastTx> mapDSTX;
static CCriticalSection cs_mapdstx;
@ -417,8 +417,8 @@ public:
static bool IsCollateralAmount(CAmount nInputAmount);
static void AddDSTX(const CDarksendBroadcastTx& dstx);
static CDarksendBroadcastTx GetDSTX(const uint256& hash);
static void AddDSTX(const CPrivateSendBroadcastTx& dstx);
static CPrivateSendBroadcastTx GetDSTX(const uint256& hash);
static void UpdatedBlockTip(const CBlockIndex *pindex);
static void SyncTransaction(const CTransaction& tx, const CBlockIndex *pindex, int posInBlock);

View File

@ -557,7 +557,7 @@ void OverviewPage::privateSendStatus()
ui->labelPrivateSendEnabled->setToolTip(strWarning);
}
// check darksend status and unlock if needed
// check privatesend status and unlock if needed
if(nBestHeight != privateSendClient.nCachedNumBlocks) {
// Balance and number of transactions might have changed
privateSendClient.nCachedNumBlocks = nBestHeight;

View File

@ -3158,7 +3158,7 @@ bool CWallet::SelectCoinsGrouppedByAddresses(std::vector<CompactTallyItem>& vecT
return vecTallyRet.size() > 0;
}
bool CWallet::SelectCoinsDark(CAmount nValueMin, CAmount nValueMax, std::vector<CTxIn>& vecTxInRet, CAmount& nValueRet, int nPrivateSendRoundsMin, int nPrivateSendRoundsMax) const
bool CWallet::SelectPrivateCoins(CAmount nValueMin, CAmount nValueMax, std::vector<CTxIn>& vecTxInRet, CAmount& nValueRet, int nPrivateSendRoundsMin, int nPrivateSendRoundsMax) const
{
CCoinControl *coinControl=NULL;

View File

@ -808,7 +808,7 @@ public:
// Coin selection
bool SelectPSInOutPairsByDenominations(int nDenom, CAmount nValueMin, CAmount nValueMax, std::vector< std::pair<CTxDSIn, CTxOut> >& vecPSInOutPairsRet);
bool GetCollateralTxDSIn(CTxDSIn& txdsinRet, CAmount& nValueRet) const;
bool SelectCoinsDark(CAmount nValueMin, CAmount nValueMax, std::vector<CTxIn>& vecTxInRet, CAmount& nValueRet, int nPrivateSendRoundsMin, int nPrivateSendRoundsMax) const;
bool SelectPrivateCoins(CAmount nValueMin, CAmount nValueMax, std::vector<CTxIn>& vecTxInRet, CAmount& nValueRet, int nPrivateSendRoundsMin, int nPrivateSendRoundsMax) const;
bool SelectCoinsGrouppedByAddresses(std::vector<CompactTallyItem>& vecTallyRet, bool fSkipDenominated = true, bool fAnonymizable = true, bool fSkipUnconfirmed = true) const;