mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Change internal references of Darksend to PrivateSend (#2372)
* Change all references to darksend to privatesend * comment references to darksend
This commit is contained in:
parent
e3df910822
commit
59932401bb
@ -94,7 +94,7 @@ public:
|
|||||||
std::map<uint256, CMasternodePing> mapSeenMasternodePing;
|
std::map<uint256, CMasternodePing> mapSeenMasternodePing;
|
||||||
// Keep track of all verifications I've seen
|
// Keep track of all verifications I've seen
|
||||||
std::map<uint256, CMasternodeVerification> mapSeenMasternodeVerification;
|
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;
|
int64_t nDsqCount;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1224,7 +1224,7 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!push && inv.type == MSG_DSTX) {
|
if (!push && inv.type == MSG_DSTX) {
|
||||||
CDarksendBroadcastTx dstx = CPrivateSend::GetDSTX(inv.hash);
|
CPrivateSendBroadcastTx dstx = CPrivateSend::GetDSTX(inv.hash);
|
||||||
if(dstx) {
|
if(dstx) {
|
||||||
connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::DSTX, dstx));
|
connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::DSTX, dstx));
|
||||||
push = true;
|
push = true;
|
||||||
@ -1940,7 +1940,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
std::vector<uint256> vEraseQueue;
|
std::vector<uint256> vEraseQueue;
|
||||||
CTransactionRef ptx;
|
CTransactionRef ptx;
|
||||||
CTxLockRequest txLockRequest;
|
CTxLockRequest txLockRequest;
|
||||||
CDarksendBroadcastTx dstx;
|
CPrivateSendBroadcastTx dstx;
|
||||||
int nInvType = MSG_TX;
|
int nInvType = MSG_TX;
|
||||||
bool fCanAutoLock = false;
|
bool fCanAutoLock = false;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ void CPrivateSendClientManager::ProcessMessage(CNode* pfrom, const std::string&
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDarksendQueue dsq;
|
CPrivateSendQueue dsq;
|
||||||
vRecv >> dsq;
|
vRecv >> dsq;
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -49,7 +49,7 @@ void CPrivateSendClientManager::ProcessMessage(CNode* pfrom, const std::string&
|
|||||||
if(!lockRecv) return;
|
if(!lockRecv) return;
|
||||||
|
|
||||||
// process every dsq only once
|
// process every dsq only once
|
||||||
for (const auto& q : vecDarksendQueue) {
|
for (const auto& q : vecPrivateSendQueue) {
|
||||||
if(q == dsq) {
|
if(q == dsq) {
|
||||||
// LogPrint("privatesend", "DSQUEUE -- %s seen\n", dsq.ToString());
|
// LogPrint("privatesend", "DSQUEUE -- %s seen\n", dsq.ToString());
|
||||||
return;
|
return;
|
||||||
@ -86,7 +86,7 @@ void CPrivateSendClientManager::ProcessMessage(CNode* pfrom, const std::string&
|
|||||||
TRY_LOCK(cs_vecqueue, lockRecv);
|
TRY_LOCK(cs_vecqueue, lockRecv);
|
||||||
if(!lockRecv) return;
|
if(!lockRecv) return;
|
||||||
|
|
||||||
for (const auto& q : vecDarksendQueue) {
|
for (const auto& q : vecPrivateSendQueue) {
|
||||||
if(q.masternodeOutpoint == dsq.masternodeOutpoint) {
|
if(q.masternodeOutpoint == dsq.masternodeOutpoint) {
|
||||||
// no way same mn can send another "not yet ready" dsq this soon
|
// 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());
|
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;
|
dsq.fTried = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vecDarksendQueue.push_back(dsq);
|
vecPrivateSendQueue.push_back(dsq);
|
||||||
dsq.Relay(connman);
|
dsq.Relay(connman);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -819,7 +819,7 @@ bool CPrivateSendClientSession::DoAutomaticDenominating(CConnman& connman, bool
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRY_LOCK(cs_darksend, lockDS);
|
TRY_LOCK(cs_privatesend, lockDS);
|
||||||
if(!lockDS) {
|
if(!lockDS) {
|
||||||
strAutoDenomResult = _("Lock is already in place.");
|
strAutoDenomResult = _("Lock is already in place.");
|
||||||
return false;
|
return false;
|
||||||
@ -994,7 +994,7 @@ bool CPrivateSendClientSession::JoinExistingQueue(CAmount nBalanceNeedsAnonymize
|
|||||||
|
|
||||||
std::vector<CAmount> vecStandardDenoms = CPrivateSend::GetStandardDenominations();
|
std::vector<CAmount> vecStandardDenoms = CPrivateSend::GetStandardDenominations();
|
||||||
// Look through the queues and see if anything matches
|
// Look through the queues and see if anything matches
|
||||||
CDarksendQueue dsq;
|
CPrivateSendQueue dsq;
|
||||||
while (privateSendClient.GetQueueItemAndTry(dsq)) {
|
while (privateSendClient.GetQueueItemAndTry(dsq)) {
|
||||||
masternode_info_t infoMn;
|
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
|
// 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
|
// no need for additional verification here
|
||||||
|
|
||||||
LogPrint("privatesend", "CPrivateSendClientSession::JoinExistingQueue -- found valid queue: %s\n", dsq.ToString());
|
LogPrint("privatesend", "CPrivateSendClientSession::JoinExistingQueue -- found valid queue: %s\n", dsq.ToString());
|
||||||
@ -1042,7 +1042,7 @@ bool CPrivateSendClientSession::JoinExistingQueue(CAmount nBalanceNeedsAnonymize
|
|||||||
|
|
||||||
nSessionDenom = dsq.nDenom;
|
nSessionDenom = dsq.nDenom;
|
||||||
infoMixingMasternode = infoMn;
|
infoMixingMasternode = infoMn;
|
||||||
pendingDsaRequest = CPendingDsaRequest(infoMn.addr, CDarksendAccept(nSessionDenom, txMyCollateral));
|
pendingDsaRequest = CPendingDsaRequest(infoMn.addr, CPrivateSendAccept(nSessionDenom, txMyCollateral));
|
||||||
connman.AddPendingMasternode(infoMn.addr);
|
connman.AddPendingMasternode(infoMn.addr);
|
||||||
// TODO: add new state POOL_STATE_CONNECTING and bump MIN_PRIVATESEND_PEER_PROTO_VERSION
|
// TODO: add new state POOL_STATE_CONNECTING and bump MIN_PRIVATESEND_PEER_PROTO_VERSION
|
||||||
SetState(POOL_STATE_QUEUE);
|
SetState(POOL_STATE_QUEUE);
|
||||||
@ -1066,7 +1066,7 @@ bool CPrivateSendClientSession::StartNewQueue(CAmount nValueMin, CAmount nBalanc
|
|||||||
// ** find the coins we'll use
|
// ** find the coins we'll use
|
||||||
std::vector<CTxIn> vecTxIn;
|
std::vector<CTxIn> vecTxIn;
|
||||||
CAmount nValueInTmp = 0;
|
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
|
// this should never happen
|
||||||
LogPrintf("CPrivateSendClientSession::StartNewQueue -- Can't mix: no compatible inputs found!\n");
|
LogPrintf("CPrivateSendClientSession::StartNewQueue -- Can't mix: no compatible inputs found!\n");
|
||||||
strAutoDenomResult = _("Can't mix: no compatible inputs found!");
|
strAutoDenomResult = _("Can't mix: no compatible inputs found!");
|
||||||
@ -1118,7 +1118,7 @@ bool CPrivateSendClientSession::StartNewQueue(CAmount nValueMin, CAmount nBalanc
|
|||||||
|
|
||||||
infoMixingMasternode = infoMn;
|
infoMixingMasternode = infoMn;
|
||||||
connman.AddPendingMasternode(infoMn.addr);
|
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
|
// TODO: add new state POOL_STATE_CONNECTING and bump MIN_PRIVATESEND_PEER_PROTO_VERSION
|
||||||
SetState(POOL_STATE_QUEUE);
|
SetState(POOL_STATE_QUEUE);
|
||||||
nTimeLastSuccessfulStep = GetTime();
|
nTimeLastSuccessfulStep = GetTime();
|
||||||
@ -1573,7 +1573,7 @@ bool CPrivateSendClientSession::CreateDenominated(const CompactTallyItem& tallyI
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPrivateSendClientSession::RelayIn(const CDarkSendEntry& entry, CConnman& connman)
|
void CPrivateSendClientSession::RelayIn(const CPrivateSendEntry& entry, CConnman& connman)
|
||||||
{
|
{
|
||||||
if(!infoMixingMasternode.fInfoValid) return;
|
if(!infoMixingMasternode.fInfoValid) return;
|
||||||
|
|
||||||
|
@ -45,24 +45,24 @@ private:
|
|||||||
static const int TIMEOUT = 15;
|
static const int TIMEOUT = 15;
|
||||||
|
|
||||||
CService addr;
|
CService addr;
|
||||||
CDarksendAccept dsa;
|
CPrivateSendAccept dsa;
|
||||||
int64_t nTimeCreated;
|
int64_t nTimeCreated;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CPendingDsaRequest():
|
CPendingDsaRequest():
|
||||||
addr(CService()),
|
addr(CService()),
|
||||||
dsa(CDarksendAccept()),
|
dsa(CPrivateSendAccept()),
|
||||||
nTimeCreated(0)
|
nTimeCreated(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CPendingDsaRequest(const CService& addr_, const CDarksendAccept& dsa_):
|
CPendingDsaRequest(const CService& addr_, const CPrivateSendAccept& dsa_):
|
||||||
addr(addr_),
|
addr(addr_),
|
||||||
dsa(dsa_),
|
dsa(dsa_),
|
||||||
nTimeCreated(GetTime())
|
nTimeCreated(GetTime())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CService GetAddr() { return addr; }
|
CService GetAddr() { return addr; }
|
||||||
CDarksendAccept GetDSA() { return dsa; }
|
CPrivateSendAccept GetDSA() { return dsa; }
|
||||||
bool IsExpired() { return GetTime() - nTimeCreated > TIMEOUT; }
|
bool IsExpired() { return GetTime() - nTimeCreated > TIMEOUT; }
|
||||||
|
|
||||||
friend bool operator==(const CPendingDsaRequest& a, const CPendingDsaRequest& b)
|
friend bool operator==(const CPendingDsaRequest& a, const CPendingDsaRequest& b)
|
||||||
@ -126,7 +126,7 @@ private:
|
|||||||
/// As a client, check and sign the final transaction
|
/// As a client, check and sign the final transaction
|
||||||
bool SignFinalTransaction(const CTransaction& finalTransactionNew, CNode* pnode, CConnman& connman);
|
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();
|
void SetNull();
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDarksendAccept dsa;
|
CPrivateSendAccept dsa;
|
||||||
vRecv >> dsa;
|
vRecv >> dsa;
|
||||||
|
|
||||||
LogPrint("privatesend", "DSACCEPT -- nDenom %d (%s) txCollateral %s", dsa.nDenom, CPrivateSend::GetDenominationsToString(dsa.nDenom), dsa.txCollateral.ToString());
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDarksendQueue dsq;
|
CPrivateSendQueue dsq;
|
||||||
vRecv >> dsq;
|
vRecv >> dsq;
|
||||||
|
|
||||||
// process every dsq only once
|
// process every dsq only once
|
||||||
for (const auto& q : vecDarksendQueue) {
|
for (const auto& q : vecPrivateSendQueue) {
|
||||||
if(q == dsq) {
|
if(q == dsq) {
|
||||||
// LogPrint("privatesend", "DSQUEUE -- %s seen\n", dsq.ToString());
|
// LogPrint("privatesend", "DSQUEUE -- %s seen\n", dsq.ToString());
|
||||||
return;
|
return;
|
||||||
@ -109,7 +109,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!dsq.fReady) {
|
if(!dsq.fReady) {
|
||||||
for (const auto& q : vecDarksendQueue) {
|
for (const auto& q : vecPrivateSendQueue) {
|
||||||
if(q.masternodeOutpoint == dsq.masternodeOutpoint) {
|
if(q.masternodeOutpoint == dsq.masternodeOutpoint) {
|
||||||
// no way same mn can send another "not yet ready" dsq this soon
|
// 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());
|
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);
|
mnodeman.AllowMixing(dsq.masternodeOutpoint);
|
||||||
|
|
||||||
LogPrint("privatesend", "DSQUEUE -- new PrivateSend queue (%s) from masternode %s\n", dsq.ToString(), mnInfo.addr.ToString());
|
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);
|
dsq.Relay(connman);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDarkSendEntry entry;
|
CPrivateSendEntry entry;
|
||||||
vRecv >> entry;
|
vRecv >> entry;
|
||||||
|
|
||||||
LogPrint("privatesend", "DSVIN -- txCollateral %s", entry.txCollateral->ToString());
|
LogPrint("privatesend", "DSVIN -- txCollateral %s", entry.txCollateral->ToString());
|
||||||
@ -349,7 +349,7 @@ void CPrivateSendServer::CommitFinalTransaction(CConnman& connman)
|
|||||||
|
|
||||||
// create and sign masternode dstx transaction
|
// create and sign masternode dstx transaction
|
||||||
if(!CPrivateSend::GetDSTX(hashTx)) {
|
if(!CPrivateSend::GetDSTX(hashTx)) {
|
||||||
CDarksendBroadcastTx dstxNew(finalTransaction, activeMasternodeInfo.outpoint, GetAdjustedTime());
|
CPrivateSendBroadcastTx dstxNew(finalTransaction, activeMasternodeInfo.outpoint, GetAdjustedTime());
|
||||||
dstxNew.Sign();
|
dstxNew.Sign();
|
||||||
CPrivateSend::AddDSTX(dstxNew);
|
CPrivateSend::AddDSTX(dstxNew);
|
||||||
}
|
}
|
||||||
@ -510,7 +510,7 @@ void CPrivateSendServer::CheckForCompleteQueue(CConnman& connman)
|
|||||||
if(nState == POOL_STATE_QUEUE && IsSessionReady()) {
|
if(nState == POOL_STATE_QUEUE && IsSessionReady()) {
|
||||||
SetState(POOL_STATE_ACCEPTING_ENTRIES);
|
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());
|
LogPrint("privatesend", "CPrivateSendServer::CheckForCompleteQueue -- queue is ready, signing and relaying (%s)\n", dsq.ToString());
|
||||||
dsq.Sign();
|
dsq.Sign();
|
||||||
dsq.Relay(connman);
|
dsq.Relay(connman);
|
||||||
@ -563,7 +563,7 @@ bool CPrivateSendServer::IsInputScriptSigValid(const CTxIn& txin)
|
|||||||
//
|
//
|
||||||
// Add a clients transaction to the pool
|
// 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;
|
if(!fMasternodeMode) return false;
|
||||||
|
|
||||||
@ -669,7 +669,7 @@ bool CPrivateSendServer::IsOutputsCompatibleWithSessionDenom(const std::vector<C
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPrivateSendServer::IsAcceptableDSA(const CDarksendAccept& dsa, PoolMessage& nMessageIDRet)
|
bool CPrivateSendServer::IsAcceptableDSA(const CPrivateSendAccept& dsa, PoolMessage& nMessageIDRet)
|
||||||
{
|
{
|
||||||
if(!fMasternodeMode) return false;
|
if(!fMasternodeMode) return false;
|
||||||
|
|
||||||
@ -691,7 +691,7 @@ bool CPrivateSendServer::IsAcceptableDSA(const CDarksendAccept& dsa, PoolMessage
|
|||||||
return true;
|
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;
|
if(!fMasternodeMode || nSessionID != 0) return false;
|
||||||
|
|
||||||
@ -716,11 +716,11 @@ bool CPrivateSendServer::CreateNewSession(const CDarksendAccept& dsa, PoolMessag
|
|||||||
|
|
||||||
if(!fUnitTest) {
|
if(!fUnitTest) {
|
||||||
//broadcast that I'm accepting entries, only if it's the first entry through
|
//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());
|
LogPrint("privatesend", "CPrivateSendServer::CreateNewSession -- signing and relaying new queue: %s\n", dsq.ToString());
|
||||||
dsq.Sign();
|
dsq.Sign();
|
||||||
dsq.Relay(connman);
|
dsq.Relay(connman);
|
||||||
vecDarksendQueue.push_back(dsq);
|
vecPrivateSendQueue.push_back(dsq);
|
||||||
}
|
}
|
||||||
|
|
||||||
vecSessionCollaterals.push_back(MakeTransactionRef(dsa.txCollateral));
|
vecSessionCollaterals.push_back(MakeTransactionRef(dsa.txCollateral));
|
||||||
@ -730,7 +730,7 @@ bool CPrivateSendServer::CreateNewSession(const CDarksendAccept& dsa, PoolMessag
|
|||||||
return true;
|
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;
|
if(!fMasternodeMode || nSessionID == 0 || IsSessionReady()) return false;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ private:
|
|||||||
bool fUnitTest;
|
bool fUnitTest;
|
||||||
|
|
||||||
/// Add a clients entry to the pool
|
/// 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
|
/// Add signature to a txin
|
||||||
bool AddScriptSig(const CTxIn& txin);
|
bool AddScriptSig(const CTxIn& txin);
|
||||||
|
|
||||||
@ -41,9 +41,9 @@ private:
|
|||||||
void CommitFinalTransaction(CConnman& connman);
|
void CommitFinalTransaction(CConnman& connman);
|
||||||
|
|
||||||
/// Is this nDenom and txCollateral acceptable?
|
/// Is this nDenom and txCollateral acceptable?
|
||||||
bool IsAcceptableDSA(const CDarksendAccept& dsa, PoolMessage &nMessageIDRet);
|
bool IsAcceptableDSA(const CPrivateSendAccept& dsa, PoolMessage &nMessageIDRet);
|
||||||
bool CreateNewSession(const CDarksendAccept& dsa, PoolMessage &nMessageIDRet, CConnman& connman);
|
bool CreateNewSession(const CPrivateSendAccept& dsa, PoolMessage &nMessageIDRet, CConnman& connman);
|
||||||
bool AddUserToExistingSession(const CDarksendAccept& dsa, PoolMessage &nMessageIDRet);
|
bool AddUserToExistingSession(const CPrivateSendAccept& dsa, PoolMessage &nMessageIDRet);
|
||||||
/// Do we have enough users to take entries?
|
/// Do we have enough users to take entries?
|
||||||
bool IsSessionReady() { return (int)vecSessionCollaterals.size() >= CPrivateSend::GetMaxPoolTransactions(); }
|
bool IsSessionReady() { return (int)vecSessionCollaterals.size() >= CPrivateSend::GetMaxPoolTransactions(); }
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
bool CDarkSendEntry::AddScriptSig(const CTxIn& txin)
|
bool CPrivateSendEntry::AddScriptSig(const CTxIn& txin)
|
||||||
{
|
{
|
||||||
for (auto& txdsin : vecTxDSIn) {
|
for (auto& txdsin : vecTxDSIn) {
|
||||||
if(txdsin.prevout == txin.prevout && txdsin.nSequence == txin.nSequence) {
|
if(txdsin.prevout == txin.prevout && txdsin.nSequence == txin.nSequence) {
|
||||||
@ -33,7 +33,7 @@ bool CDarkSendEntry::AddScriptSig(const CTxIn& txin)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 CDarksendQueue::GetSignatureHash() const
|
uint256 CPrivateSendQueue::GetSignatureHash() const
|
||||||
{
|
{
|
||||||
// Remove after migration to 70211
|
// Remove after migration to 70211
|
||||||
{
|
{
|
||||||
@ -45,7 +45,7 @@ uint256 CDarksendQueue::GetSignatureHash() const
|
|||||||
// return SerializeHash(*this);
|
// return SerializeHash(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDarksendQueue::Sign()
|
bool CPrivateSendQueue::Sign()
|
||||||
{
|
{
|
||||||
if(!fMasternodeMode) return false;
|
if(!fMasternodeMode) return false;
|
||||||
|
|
||||||
@ -59,12 +59,12 @@ bool CDarksendQueue::Sign()
|
|||||||
uint256 hash = GetSignatureHash();
|
uint256 hash = GetSignatureHash();
|
||||||
|
|
||||||
if (!CHashSigner::SignHash(hash, activeMasternodeInfo.legacyKeyOperator, vchSig)) {
|
if (!CHashSigner::SignHash(hash, activeMasternodeInfo.legacyKeyOperator, vchSig)) {
|
||||||
LogPrintf("CDarksendQueue::Sign -- SignHash() failed\n");
|
LogPrintf("CPrivateSendQueue::Sign -- SignHash() failed\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CHashSigner::VerifyHash(hash, activeMasternodeInfo.legacyKeyIDOperator, vchSig, strError)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -74,12 +74,12 @@ bool CDarksendQueue::Sign()
|
|||||||
std::to_string(fReady);
|
std::to_string(fReady);
|
||||||
|
|
||||||
if(!CMessageSigner::SignMessage(strMessage, vchSig, activeMasternodeInfo.legacyKeyOperator)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!CMessageSigner::VerifyMessage(activeMasternodeInfo.legacyKeyIDOperator, vchSig, strMessage, strError)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ bool CDarksendQueue::Sign()
|
|||||||
return true;
|
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 = "";
|
std::string strError = "";
|
||||||
if (deterministicMNManager->IsDeterministicMNsSporkActive()) {
|
if (deterministicMNManager->IsDeterministicMNsSporkActive()) {
|
||||||
@ -104,7 +104,7 @@ bool CDarksendQueue::CheckSignature(const CKeyID& keyIDOperator, const CBLSPubli
|
|||||||
|
|
||||||
if (!CHashSigner::VerifyHash(hash, keyIDOperator, vchSig, strError)) {
|
if (!CHashSigner::VerifyHash(hash, keyIDOperator, vchSig, strError)) {
|
||||||
// we don't care about queues with old signature format
|
// 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;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -114,7 +114,7 @@ bool CDarksendQueue::CheckSignature(const CKeyID& keyIDOperator, const CBLSPubli
|
|||||||
std::to_string(fReady);
|
std::to_string(fReady);
|
||||||
|
|
||||||
if(!CMessageSigner::VerifyMessage(keyIDOperator, vchSig, strMessage, strError)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ bool CDarksendQueue::CheckSignature(const CKeyID& keyIDOperator, const CBLSPubli
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDarksendQueue::Relay(CConnman& connman)
|
bool CPrivateSendQueue::Relay(CConnman& connman)
|
||||||
{
|
{
|
||||||
connman.ForEachNode([&connman, this](CNode* pnode) {
|
connman.ForEachNode([&connman, this](CNode* pnode) {
|
||||||
CNetMsgMaker msgMaker(pnode->GetSendVersion());
|
CNetMsgMaker msgMaker(pnode->GetSendVersion());
|
||||||
@ -132,12 +132,12 @@ bool CDarksendQueue::Relay(CConnman& connman)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 CDarksendBroadcastTx::GetSignatureHash() const
|
uint256 CPrivateSendBroadcastTx::GetSignatureHash() const
|
||||||
{
|
{
|
||||||
return SerializeHash(*this);
|
return SerializeHash(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDarksendBroadcastTx::Sign()
|
bool CPrivateSendBroadcastTx::Sign()
|
||||||
{
|
{
|
||||||
if(!fMasternodeMode) return false;
|
if(!fMasternodeMode) return false;
|
||||||
|
|
||||||
@ -152,24 +152,24 @@ bool CDarksendBroadcastTx::Sign()
|
|||||||
uint256 hash = GetSignatureHash();
|
uint256 hash = GetSignatureHash();
|
||||||
|
|
||||||
if (!CHashSigner::SignHash(hash, activeMasternodeInfo.legacyKeyOperator, vchSig)) {
|
if (!CHashSigner::SignHash(hash, activeMasternodeInfo.legacyKeyOperator, vchSig)) {
|
||||||
LogPrintf("CDarksendBroadcastTx::Sign -- SignHash() failed\n");
|
LogPrintf("CPrivateSendBroadcastTx::Sign -- SignHash() failed\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CHashSigner::VerifyHash(hash, activeMasternodeInfo.legacyKeyIDOperator, vchSig, strError)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::string strMessage = tx->GetHash().ToString() + std::to_string(sigTime);
|
std::string strMessage = tx->GetHash().ToString() + std::to_string(sigTime);
|
||||||
|
|
||||||
if(!CMessageSigner::SignMessage(strMessage, vchSig, activeMasternodeInfo.legacyKeyOperator)) {
|
if(!CMessageSigner::SignMessage(strMessage, vchSig, activeMasternodeInfo.legacyKeyOperator)) {
|
||||||
LogPrintf("CDarksendBroadcastTx::Sign -- SignMessage() failed\n");
|
LogPrintf("CPrivateSendBroadcastTx::Sign -- SignMessage() failed\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!CMessageSigner::VerifyMessage(activeMasternodeInfo.legacyKeyIDOperator, vchSig, strMessage, strError)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ bool CDarksendBroadcastTx::Sign()
|
|||||||
return true;
|
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 = "";
|
std::string strError = "";
|
||||||
|
|
||||||
@ -195,14 +195,14 @@ bool CDarksendBroadcastTx::CheckSignature(const CKeyID& keyIDOperator, const CBL
|
|||||||
|
|
||||||
if (!CHashSigner::VerifyHash(hash, keyIDOperator, vchSig, strError)) {
|
if (!CHashSigner::VerifyHash(hash, keyIDOperator, vchSig, strError)) {
|
||||||
// we don't care about dstxes with old signature format
|
// 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;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::string strMessage = tx->GetHash().ToString() + std::to_string(sigTime);
|
std::string strMessage = tx->GetHash().ToString() + std::to_string(sigTime);
|
||||||
|
|
||||||
if(!CMessageSigner::VerifyMessage(keyIDOperator, vchSig, strMessage, strError)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ bool CDarksendBroadcastTx::CheckSignature(const CKeyID& keyIDOperator, const CBL
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDarksendBroadcastTx::IsExpired(int nHeight)
|
bool CPrivateSendBroadcastTx::IsExpired(int nHeight)
|
||||||
{
|
{
|
||||||
// expire confirmed DSTXes after ~1h since confirmation
|
// expire confirmed DSTXes after ~1h since confirmation
|
||||||
return (nConfirmedHeight != -1) && (nHeight - nConfirmedHeight > 24);
|
return (nConfirmedHeight != -1) && (nHeight - nConfirmedHeight > 24);
|
||||||
@ -219,7 +219,7 @@ bool CDarksendBroadcastTx::IsExpired(int nHeight)
|
|||||||
void CPrivateSendBaseSession::SetNull()
|
void CPrivateSendBaseSession::SetNull()
|
||||||
{
|
{
|
||||||
// Both sides
|
// Both sides
|
||||||
LOCK(cs_darksend);
|
LOCK(cs_privatesend);
|
||||||
nState = POOL_STATE_IDLE;
|
nState = POOL_STATE_IDLE;
|
||||||
nSessionID = 0;
|
nSessionID = 0;
|
||||||
nSessionDenom = 0;
|
nSessionDenom = 0;
|
||||||
@ -232,7 +232,7 @@ void CPrivateSendBaseSession::SetNull()
|
|||||||
void CPrivateSendBaseManager::SetNull()
|
void CPrivateSendBaseManager::SetNull()
|
||||||
{
|
{
|
||||||
LOCK(cs_vecqueue);
|
LOCK(cs_vecqueue);
|
||||||
vecDarksendQueue.clear();
|
vecPrivateSendQueue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPrivateSendBaseManager::CheckQueue()
|
void CPrivateSendBaseManager::CheckQueue()
|
||||||
@ -241,21 +241,21 @@ void CPrivateSendBaseManager::CheckQueue()
|
|||||||
if(!lockDS) return; // it's ok to fail here, we run this quite frequently
|
if(!lockDS) return; // it's ok to fail here, we run this quite frequently
|
||||||
|
|
||||||
// check mixing queue objects for timeouts
|
// check mixing queue objects for timeouts
|
||||||
std::vector<CDarksendQueue>::iterator it = vecDarksendQueue.begin();
|
std::vector<CPrivateSendQueue>::iterator it = vecPrivateSendQueue.begin();
|
||||||
while(it != vecDarksendQueue.end()) {
|
while(it != vecPrivateSendQueue.end()) {
|
||||||
if((*it).IsExpired()) {
|
if((*it).IsExpired()) {
|
||||||
LogPrint("privatesend", "CPrivateSendBaseManager::%s -- Removing expired queue (%s)\n", __func__, (*it).ToString());
|
LogPrint("privatesend", "CPrivateSendBaseManager::%s -- Removing expired queue (%s)\n", __func__, (*it).ToString());
|
||||||
it = vecDarksendQueue.erase(it);
|
it = vecPrivateSendQueue.erase(it);
|
||||||
} else ++it;
|
} else ++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPrivateSendBaseManager::GetQueueItemAndTry(CDarksendQueue& dsqRet)
|
bool CPrivateSendBaseManager::GetQueueItemAndTry(CPrivateSendQueue& dsqRet)
|
||||||
{
|
{
|
||||||
TRY_LOCK(cs_vecqueue, lockDS);
|
TRY_LOCK(cs_vecqueue, lockDS);
|
||||||
if(!lockDS) return false; // it's ok to fail here, we run this quite frequently
|
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
|
// only try each queue once
|
||||||
if(dsq.fTried || dsq.IsExpired()) continue;
|
if(dsq.fTried || dsq.IsExpired()) continue;
|
||||||
dsq.fTried = true;
|
dsq.fTried = true;
|
||||||
@ -281,7 +281,7 @@ std::string CPrivateSendBaseSession::GetStateString() const
|
|||||||
|
|
||||||
// Definitions for static data members
|
// Definitions for static data members
|
||||||
std::vector<CAmount> CPrivateSend::vecStandardDenominations;
|
std::vector<CAmount> CPrivateSend::vecStandardDenominations;
|
||||||
std::map<uint256, CDarksendBroadcastTx> CPrivateSend::mapDSTX;
|
std::map<uint256, CPrivateSendBroadcastTx> CPrivateSend::mapDSTX;
|
||||||
CCriticalSection CPrivateSend::cs_mapdstx;
|
CCriticalSection CPrivateSend::cs_mapdstx;
|
||||||
|
|
||||||
void CPrivateSend::InitStandardDenominations()
|
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);
|
LOCK(cs_mapdstx);
|
||||||
mapDSTX.insert(std::make_pair(dstx.tx->GetHash(), dstx));
|
mapDSTX.insert(std::make_pair(dstx.tx->GetHash(), dstx));
|
||||||
}
|
}
|
||||||
|
|
||||||
CDarksendBroadcastTx CPrivateSend::GetDSTX(const uint256& hash)
|
CPrivateSendBroadcastTx CPrivateSend::GetDSTX(const uint256& hash)
|
||||||
{
|
{
|
||||||
LOCK(cs_mapdstx);
|
LOCK(cs_mapdstx);
|
||||||
auto it = mapDSTX.find(hash);
|
auto it = mapDSTX.find(hash);
|
||||||
return (it == mapDSTX.end()) ? CDarksendBroadcastTx() : it->second;
|
return (it == mapDSTX.end()) ? CPrivateSendBroadcastTx() : it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPrivateSend::CheckDSTXes(int nHeight)
|
void CPrivateSend::CheckDSTXes(int nHeight)
|
||||||
{
|
{
|
||||||
LOCK(cs_mapdstx);
|
LOCK(cs_mapdstx);
|
||||||
std::map<uint256, CDarksendBroadcastTx>::iterator it = mapDSTX.begin();
|
std::map<uint256, CPrivateSendBroadcastTx>::iterator it = mapDSTX.begin();
|
||||||
while(it != mapDSTX.end()) {
|
while(it != mapDSTX.end()) {
|
||||||
if (it->second.IsExpired(nHeight)) {
|
if (it->second.IsExpired(nHeight)) {
|
||||||
mapDSTX.erase(it++);
|
mapDSTX.erase(it++);
|
||||||
|
@ -96,18 +96,18 @@ public:
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CDarksendAccept
|
class CPrivateSendAccept
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int nDenom;
|
int nDenom;
|
||||||
CMutableTransaction txCollateral;
|
CMutableTransaction txCollateral;
|
||||||
|
|
||||||
CDarksendAccept() :
|
CPrivateSendAccept() :
|
||||||
nDenom(0),
|
nDenom(0),
|
||||||
txCollateral(CMutableTransaction())
|
txCollateral(CMutableTransaction())
|
||||||
{};
|
{};
|
||||||
|
|
||||||
CDarksendAccept(int nDenom, const CMutableTransaction& txCollateral) :
|
CPrivateSendAccept(int nDenom, const CMutableTransaction& txCollateral) :
|
||||||
nDenom(nDenom),
|
nDenom(nDenom),
|
||||||
txCollateral(txCollateral)
|
txCollateral(txCollateral)
|
||||||
{};
|
{};
|
||||||
@ -125,14 +125,14 @@ public:
|
|||||||
READWRITE(txCollateral);
|
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;
|
return a.nDenom == b.nDenom && a.txCollateral == b.txCollateral;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// A clients transaction in the mixing pool
|
// A clients transaction in the mixing pool
|
||||||
class CDarkSendEntry
|
class CPrivateSendEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::vector<CTxDSIn> vecTxDSIn;
|
std::vector<CTxDSIn> vecTxDSIn;
|
||||||
@ -141,14 +141,14 @@ public:
|
|||||||
// memory only
|
// memory only
|
||||||
CService addr;
|
CService addr;
|
||||||
|
|
||||||
CDarkSendEntry() :
|
CPrivateSendEntry() :
|
||||||
vecTxDSIn(std::vector<CTxDSIn>()),
|
vecTxDSIn(std::vector<CTxDSIn>()),
|
||||||
vecTxOut(std::vector<CTxOut>()),
|
vecTxOut(std::vector<CTxOut>()),
|
||||||
txCollateral(MakeTransactionRef()),
|
txCollateral(MakeTransactionRef()),
|
||||||
addr(CService())
|
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),
|
vecTxDSIn(vecTxDSIn),
|
||||||
vecTxOut(vecTxOut),
|
vecTxOut(vecTxOut),
|
||||||
txCollateral(MakeTransactionRef(txCollateral)),
|
txCollateral(MakeTransactionRef(txCollateral)),
|
||||||
@ -171,7 +171,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* A currently in progress mixing merge and denomination information
|
* A currently in progress mixing merge and denomination information
|
||||||
*/
|
*/
|
||||||
class CDarksendQueue
|
class CPrivateSendQueue
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int nDenom;
|
int nDenom;
|
||||||
@ -183,7 +183,7 @@ public:
|
|||||||
// memory only
|
// memory only
|
||||||
bool fTried;
|
bool fTried;
|
||||||
|
|
||||||
CDarksendQueue() :
|
CPrivateSendQueue() :
|
||||||
nDenom(0),
|
nDenom(0),
|
||||||
nInputCount(0),
|
nInputCount(0),
|
||||||
masternodeOutpoint(COutPoint()),
|
masternodeOutpoint(COutPoint()),
|
||||||
@ -193,7 +193,7 @@ public:
|
|||||||
fTried(false)
|
fTried(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CDarksendQueue(int nDenom, COutPoint outpoint, int64_t nTime, bool fReady) :
|
CPrivateSendQueue(int nDenom, COutPoint outpoint, int64_t nTime, bool fReady) :
|
||||||
nDenom(nDenom),
|
nDenom(nDenom),
|
||||||
nInputCount(0),
|
nInputCount(0),
|
||||||
masternodeOutpoint(outpoint),
|
masternodeOutpoint(outpoint),
|
||||||
@ -243,7 +243,7 @@ public:
|
|||||||
nDenom, nTime, fReady ? "true" : "false", fTried ? "true" : "false", masternodeOutpoint.ToStringShort());
|
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;
|
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.
|
/** Helper class to store mixing transaction (tx) information.
|
||||||
*/
|
*/
|
||||||
class CDarksendBroadcastTx
|
class CPrivateSendBroadcastTx
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// memory only
|
// memory only
|
||||||
@ -264,7 +264,7 @@ public:
|
|||||||
std::vector<unsigned char> vchSig;
|
std::vector<unsigned char> vchSig;
|
||||||
int64_t sigTime;
|
int64_t sigTime;
|
||||||
|
|
||||||
CDarksendBroadcastTx() :
|
CPrivateSendBroadcastTx() :
|
||||||
nConfirmedHeight(-1),
|
nConfirmedHeight(-1),
|
||||||
tx(MakeTransactionRef()),
|
tx(MakeTransactionRef()),
|
||||||
masternodeOutpoint(),
|
masternodeOutpoint(),
|
||||||
@ -272,7 +272,7 @@ public:
|
|||||||
sigTime(0)
|
sigTime(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CDarksendBroadcastTx(const CTransactionRef& _tx, COutPoint _outpoint, int64_t _sigTime) :
|
CPrivateSendBroadcastTx(const CTransactionRef& _tx, COutPoint _outpoint, int64_t _sigTime) :
|
||||||
nConfirmedHeight(-1),
|
nConfirmedHeight(-1),
|
||||||
tx(_tx),
|
tx(_tx),
|
||||||
masternodeOutpoint(_outpoint),
|
masternodeOutpoint(_outpoint),
|
||||||
@ -292,17 +292,17 @@ public:
|
|||||||
READWRITE(sigTime);
|
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;
|
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);
|
return !(a == b);
|
||||||
}
|
}
|
||||||
explicit operator bool() const
|
explicit operator bool() const
|
||||||
{
|
{
|
||||||
return *this != CDarksendBroadcastTx();
|
return *this != CPrivateSendBroadcastTx();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 GetSignatureHash() const;
|
uint256 GetSignatureHash() const;
|
||||||
@ -318,9 +318,9 @@ public:
|
|||||||
class CPrivateSendBaseSession
|
class CPrivateSendBaseSession
|
||||||
{
|
{
|
||||||
protected:
|
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
|
PoolState nState; // should be one of the POOL_STATE_XXX values
|
||||||
int64_t nTimeLastSuccessfulStep; // the time when last successful mixing step was performed
|
int64_t nTimeLastSuccessfulStep; // the time when last successful mixing step was performed
|
||||||
@ -356,16 +356,16 @@ protected:
|
|||||||
mutable CCriticalSection cs_vecqueue;
|
mutable CCriticalSection cs_vecqueue;
|
||||||
|
|
||||||
// The current mixing sessions in progress on the network
|
// The current mixing sessions in progress on the network
|
||||||
std::vector<CDarksendQueue> vecDarksendQueue;
|
std::vector<CPrivateSendQueue> vecPrivateSendQueue;
|
||||||
|
|
||||||
void SetNull();
|
void SetNull();
|
||||||
void CheckQueue();
|
void CheckQueue();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CPrivateSendBaseManager() : vecDarksendQueue() {}
|
CPrivateSendBaseManager() : vecPrivateSendQueue() {}
|
||||||
|
|
||||||
int GetQueueSize() const { return vecDarksendQueue.size(); }
|
int GetQueueSize() const { return vecPrivateSendQueue.size(); }
|
||||||
bool GetQueueItemAndTry(CDarksendQueue& dsqRet);
|
bool GetQueueItemAndTry(CPrivateSendQueue& dsqRet);
|
||||||
};
|
};
|
||||||
|
|
||||||
// helper class
|
// helper class
|
||||||
@ -382,7 +382,7 @@ private:
|
|||||||
|
|
||||||
// static members
|
// static members
|
||||||
static std::vector<CAmount> vecStandardDenominations;
|
static std::vector<CAmount> vecStandardDenominations;
|
||||||
static std::map<uint256, CDarksendBroadcastTx> mapDSTX;
|
static std::map<uint256, CPrivateSendBroadcastTx> mapDSTX;
|
||||||
|
|
||||||
static CCriticalSection cs_mapdstx;
|
static CCriticalSection cs_mapdstx;
|
||||||
|
|
||||||
@ -417,8 +417,8 @@ public:
|
|||||||
|
|
||||||
static bool IsCollateralAmount(CAmount nInputAmount);
|
static bool IsCollateralAmount(CAmount nInputAmount);
|
||||||
|
|
||||||
static void AddDSTX(const CDarksendBroadcastTx& dstx);
|
static void AddDSTX(const CPrivateSendBroadcastTx& dstx);
|
||||||
static CDarksendBroadcastTx GetDSTX(const uint256& hash);
|
static CPrivateSendBroadcastTx GetDSTX(const uint256& hash);
|
||||||
|
|
||||||
static void UpdatedBlockTip(const CBlockIndex *pindex);
|
static void UpdatedBlockTip(const CBlockIndex *pindex);
|
||||||
static void SyncTransaction(const CTransaction& tx, const CBlockIndex *pindex, int posInBlock);
|
static void SyncTransaction(const CTransaction& tx, const CBlockIndex *pindex, int posInBlock);
|
||||||
|
@ -557,7 +557,7 @@ void OverviewPage::privateSendStatus()
|
|||||||
ui->labelPrivateSendEnabled->setToolTip(strWarning);
|
ui->labelPrivateSendEnabled->setToolTip(strWarning);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check darksend status and unlock if needed
|
// check privatesend status and unlock if needed
|
||||||
if(nBestHeight != privateSendClient.nCachedNumBlocks) {
|
if(nBestHeight != privateSendClient.nCachedNumBlocks) {
|
||||||
// Balance and number of transactions might have changed
|
// Balance and number of transactions might have changed
|
||||||
privateSendClient.nCachedNumBlocks = nBestHeight;
|
privateSendClient.nCachedNumBlocks = nBestHeight;
|
||||||
|
@ -3158,7 +3158,7 @@ bool CWallet::SelectCoinsGrouppedByAddresses(std::vector<CompactTallyItem>& vecT
|
|||||||
return vecTallyRet.size() > 0;
|
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;
|
CCoinControl *coinControl=NULL;
|
||||||
|
|
||||||
|
@ -808,7 +808,7 @@ public:
|
|||||||
// Coin selection
|
// Coin selection
|
||||||
bool SelectPSInOutPairsByDenominations(int nDenom, CAmount nValueMin, CAmount nValueMax, std::vector< std::pair<CTxDSIn, CTxOut> >& vecPSInOutPairsRet);
|
bool SelectPSInOutPairsByDenominations(int nDenom, CAmount nValueMin, CAmount nValueMax, std::vector< std::pair<CTxDSIn, CTxOut> >& vecPSInOutPairsRet);
|
||||||
bool GetCollateralTxDSIn(CTxDSIn& txdsinRet, CAmount& nValueRet) const;
|
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;
|
bool SelectCoinsGrouppedByAddresses(std::vector<CompactTallyItem>& vecTallyRet, bool fSkipDenominated = true, bool fAnonymizable = true, bool fSkipUnconfirmed = true) const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user