Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#include <privatesend-client.h>
Public Member Functions | |
CPrivateSendClientSession () | |
void | ProcessMessage (CNode *pfrom, const std::string &strCommand, CDataStream &vRecv, CConnman &connman) |
void | UnlockCoins () |
void | ResetPool () |
std::string | GetStatus (bool fWaitForBlock) |
bool | GetMixingMasternodeInfo (CDeterministicMNCPtr &ret) const |
bool | DoAutomaticDenominating (CConnman &connman, bool fDryRun=false) |
Passively run mixing in the background according to the configuration in settings. More... | |
bool | SubmitDenominate (CConnman &connman) |
As a client, submit part of a future mixing transaction to a Masternode to start the process. More... | |
bool | ProcessPendingDsaRequest (CConnman &connman) |
bool | CheckTimeout () |
void | GetJsonInfo (UniValue &obj) const |
Public Member Functions inherited from CPrivateSendBaseSession | |
CPrivateSendBaseSession () | |
int | GetState () const |
std::string | GetStateString () const |
int | GetEntriesCount () const |
Private Member Functions | |
bool | CreateDenominated (CAmount nBalanceToDenominate) |
Create denominations. More... | |
bool | CreateDenominated (CAmount nBalanceToDenominate, const CompactTallyItem &tallyItem, bool fCreateMixingCollaterals) |
bool | MakeCollateralAmounts () |
Split up large inputs or make fee sized inputs. More... | |
bool | MakeCollateralAmounts (const CompactTallyItem &tallyItem, bool fTryDenominated) |
bool | JoinExistingQueue (CAmount nBalanceNeedsAnonymized, CConnman &connman) |
bool | StartNewQueue (CAmount nBalanceNeedsAnonymized, CConnman &connman) |
bool | SelectDenominate (std::string &strErrorRet, std::vector< std::pair< CTxDSIn, CTxOut > > &vecPSInOutPairsRet) |
step 0: select denominated inputs and txouts More... | |
bool | PrepareDenominate (int nMinRounds, int nMaxRounds, std::string &strErrorRet, const std::vector< std::pair< CTxDSIn, CTxOut > > &vecPSInOutPairsIn, std::vector< std::pair< CTxDSIn, CTxOut > > &vecPSInOutPairsRet, bool fDryRun=false) |
step 1: prepare denominated inputs and outputs More... | |
bool | SendDenominate (const std::vector< std::pair< CTxDSIn, CTxOut > > &vecPSInOutPairsIn, CConnman &connman) |
step 2: send denominated inputs and outputs prepared in step 1 More... | |
void | ProcessPoolStateUpdate (CPrivateSendStatusUpdate psssup) |
Process Masternode updates about the progress of mixing. More... | |
void | SetState (PoolState nStateNew) |
void | CompletedTransaction (PoolMessage nMessageID) |
bool | SignFinalTransaction (const CTransaction &finalTransactionNew, CNode *pnode, CConnman &connman) |
As a client, check and sign the final transaction. More... | |
void | RelayIn (const CPrivateSendEntry &entry, CConnman &connman) |
void | SetNull () |
Private Attributes | |
std::vector< COutPoint > | vecOutPointLocked |
std::string | strLastMessage |
std::string | strAutoDenomResult |
CDeterministicMNCPtr | mixingMasternode |
CMutableTransaction | txMyCollateral |
CPendingDsaRequest | pendingDsaRequest |
CKeyHolderStorage | keyHolderStorage |
Additional Inherited Members | |
Public Attributes inherited from CPrivateSendBaseSession | |
int | nSessionDenom |
Protected Member Functions inherited from CPrivateSendBaseSession | |
void | SetNull () |
bool | IsValidInOuts (const std::vector< CTxIn > &vin, const std::vector< CTxOut > &vout, PoolMessage &nMessageIDRet, bool *fConsumeCollateralRet) const |
Protected Attributes inherited from CPrivateSendBaseSession | |
CCriticalSection | cs_privatesend |
std::vector< CPrivateSendEntry > | vecEntries |
PoolState | nState |
int64_t | nTimeLastSuccessfulStep |
int | nSessionID |
CMutableTransaction | finalMutableTransaction |
Detailed Description
Definition at line 101 of file privatesend-client.h.
Constructor & Destructor Documentation
◆ CPrivateSendClientSession()
|
inline |
Definition at line 148 of file privatesend-client.h.
Member Function Documentation
◆ CheckTimeout()
bool CPrivateSendClientSession::CheckTimeout | ( | ) |
Definition at line 361 of file privatesend-client.cpp.
References ERR_SESSION, fMasternodeMode, CPrivateSend::GetMessageByID(), GetTime(), keyHolderStorage, LogPrint, CPrivateSendBaseSession::nSessionID, CPrivateSendBaseSession::nState, CPrivateSendBaseSession::nTimeLastSuccessfulStep, POOL_STATE_ERROR, POOL_STATE_IDLE, POOL_STATE_SIGNING, BCLog::PRIVATESEND, PRIVATESEND_QUEUE_TIMEOUT, PRIVATESEND_SIGNING_TIMEOUT, CKeyHolderStorage::ReturnAll(), SetNull(), SetState(), strLastMessage, and UnlockCoins().
◆ CompletedTransaction()
|
private |
Definition at line 642 of file privatesend-client.cpp.
References fMasternodeMode, CPrivateSend::GetMessageByID(), CKeyHolderStorage::KeepAll(), keyHolderStorage, LogPrint, MSG_SUCCESS, BCLog::PRIVATESEND, privateSendClient, CKeyHolderStorage::ReturnAll(), SetNull(), strLastMessage, UnlockCoins(), and CPrivateSendClientManager::UpdatedSuccessBlock().
Referenced by ProcessMessage().
◆ CreateDenominated() [1/2]
|
private |
Create denominations.
Definition at line 1452 of file privatesend-client.cpp.
References CTxMemPool::cs, cs_main, CPrivateSendClientManager::fEnablePrivateSend, CPrivateSendClientManager::fPrivateSendRunning, GetWallets(), LOCK, LOCK2, LogPrint, mempool, CompactTallyItem::nAmount, BCLog::PRIVATESEND, and privateSendClient.
Referenced by DoAutomaticDenominating().
◆ CreateDenominated() [2/2]
|
private |
Definition at line 1486 of file privatesend-client.cpp.
References CTransactionBuilder::AddOutput(), AssertLockHeld(), COIN, CTransactionBuilder::Commit(), CTransactionBuilder::CouldAddOutput(), CTransactionBuilder::CouldAddOutputs(), CTransactionBuilder::CountOutputs(), CTxMemPool::cs, cs_main, CPrivateSendClientManager::fEnablePrivateSend, CPrivateSendClientManager::fPrivateSendRunning, CTransactionBuilder::GetAmountLeft(), CPrivateSend::GetMaxCollateralAmount(), CPrivateSend::GetSmallestDenomination(), CPrivateSend::GetStandardDenominations(), GetWallets(), CPrivateSend::IsDenominatedAmount(), LogPrint, mempool, CompactTallyItem::nAmount, CPrivateSendClientManager::nPrivateSendDenomsGoal, CPrivateSendClientManager::nPrivateSendDenomsHardCap, BCLog::PRIVATESEND, PRIVATESEND_DENOM_OUTPUTS_THRESHOLD, privateSendClient, CTransactionBuilder::ToString(), CPrivateSendClientManager::UpdatedSuccessBlock(), and CompactTallyItem::vecOutPoints.
◆ DoAutomaticDenominating()
bool CPrivateSendClientSession::DoAutomaticDenominating | ( | CConnman & | connman, |
bool | fDryRun = false |
||
) |
Passively run mixing in the background according to the configuration in settings.
Definition at line 744 of file privatesend-client.cpp.
References _(), COIN, CreateDenominated(), CTxMemPool::cs, cs_main, CPrivateSendBaseSession::cs_privatesend, deterministicMNManager, CPrivateSendClientManager::fEnablePrivateSend, fMasternodeMode, FormatMoney(), CPrivateSendClientManager::fPrivateSendMultiSession, CPrivateSendClientManager::fPrivateSendRunning, CPrivateSend::GetCollateralAmount(), CPrivateSendBaseSession::GetEntriesCount(), CPrivateSend::GetMaxCollateralAmount(), CPrivateSend::GetSmallestDenomination(), CPrivateSend::GetStandardDenominations(), GetWallets(), CMasternodeSync::IsBlockchainSynced(), CPrivateSend::IsCollateralValid(), JoinExistingQueue(), keyHolderStorage, LOCK, LOCK2, LogPrint, MakeCollateralAmounts(), masternodeSync, mempool, CChainParams::NetworkIDString(), CPrivateSendClientManager::nPrivateSendAmount, CPrivateSendBaseSession::nSessionID, CPrivateSendBaseSession::nState, Params(), POOL_STATE_IDLE, BCLog::PRIVATESEND, privateSendClient, CBaseChainParams::REGTEST, CKeyHolderStorage::ReturnAll(), SetNull(), StartNewQueue(), strAutoDenomResult, TRY_LOCK, txMyCollateral, UnlockCoins(), vecOutPointLocked, and CMutableTransaction::vin.
◆ GetJsonInfo()
void CPrivateSendClientSession::GetJsonInfo | ( | UniValue & | obj | ) | const |
Definition at line 1717 of file privatesend-client.cpp.
References UniValue::clear(), CPrivateSend::DenominationToAmount(), CPrivateSendBaseSession::GetEntriesCount(), CPrivateSendBaseSession::GetStateString(), mixingMasternode, CPrivateSendBaseSession::nSessionDenom, Pair(), UniValue::push_back(), UniValue::setObject(), and ValueFromAmount().
◆ GetMixingMasternodeInfo()
bool CPrivateSendClientSession::GetMixingMasternodeInfo | ( | CDeterministicMNCPtr & | ret | ) | const |
Definition at line 340 of file privatesend-client.cpp.
References mixingMasternode.
◆ GetStatus()
std::string CPrivateSendClientSession::GetStatus | ( | bool | fWaitForBlock | ) |
Definition at line 277 of file privatesend-client.cpp.
References _(), CMasternodeSync::IsBlockchainSynced(), masternodeSync, CPrivateSendBaseSession::nState, POOL_STATE_ACCEPTING_ENTRIES, POOL_STATE_ERROR, POOL_STATE_IDLE, POOL_STATE_QUEUE, POOL_STATE_SIGNING, strAutoDenomResult, strLastMessage, and strprintf.
◆ JoinExistingQueue()
|
private |
Definition at line 1014 of file privatesend-client.cpp.
References _(), CConnman::AddPendingMasternode(), CPrivateSendClientManager::AddUsedMasternode(), CPrivateSend::DenominationToString(), deterministicMNManager, CPrivateSendClientManager::fEnablePrivateSend, CPrivateSendClientManager::fPrivateSendRunning, CPrivateSendBaseManager::GetQueueItemAndTry(), GetTime(), GetWallets(), CConnman::IsMasternodeOrDisconnectRequested(), LogPrint, CPrivateSendQueue::masternodeOutpoint, mixingMasternode, CPrivateSendQueue::nDenom, CPrivateSendBaseSession::nSessionDenom, CPrivateSendBaseSession::nTimeLastSuccessfulStep, pendingDsaRequest, POOL_STATE_QUEUE, BCLog::PRIVATESEND, privateSendClient, SetState(), strAutoDenomResult, CPrivateSendQueue::ToString(), COutPoint::ToStringShort(), and txMyCollateral.
Referenced by DoAutomaticDenominating().
◆ MakeCollateralAmounts() [1/2]
|
private |
Split up large inputs or make fee sized inputs.
Definition at line 1324 of file privatesend-client.cpp.
References CTxMemPool::cs, cs_main, CPrivateSendClientManager::fEnablePrivateSend, CPrivateSendClientManager::fPrivateSendRunning, GetWallets(), LOCK, LOCK2, LogPrint, mempool, CompactTallyItem::nAmount, BCLog::PRIVATESEND, and privateSendClient.
Referenced by DoAutomaticDenominating().
◆ MakeCollateralAmounts() [2/2]
|
private |
Definition at line 1364 of file privatesend-client.cpp.
References CTransactionBuilder::AddOutput(), AssertLockHeld(), CTransactionBuilder::Commit(), CTransactionBuilder::CouldAddOutput(), CTransactionBuilder::CouldAddOutputs(), CTxMemPool::cs, cs_main, CPrivateSendClientManager::fEnablePrivateSend, CPrivateSendClientManager::fPrivateSendRunning, CTransactionBuilderOutput::GetAmount(), CTransactionBuilder::GetAmountLeft(), CPrivateSend::GetCollateralAmount(), CPrivateSend::GetMaxCollateralAmount(), GetWallets(), CPrivateSend::IsCollateralAmount(), CPrivateSend::IsDenominatedAmount(), CTransactionBuilder::IsDust(), LogPrint, mempool, CompactTallyItem::nAmount, BCLog::PRIVATESEND, privateSendClient, CTransactionBuilder::ToString(), CTransactionBuilderOutput::UpdateAmount(), CPrivateSendClientManager::UpdatedSuccessBlock(), and CompactTallyItem::vecOutPoints.
◆ PrepareDenominate()
|
private |
step 1: prepare denominated inputs and outputs
Definition at line 1264 of file privatesend-client.cpp.
References CKeyHolderStorage::AddKey(), AssertLockHeld(), cs_main, CPrivateSend::DenominationToAmount(), GetRandInt(), GetWallets(), CPrivateSend::IsValidDenomination(), keyHolderStorage, CPrivateSendBaseSession::nSessionDenom, PRIVATESEND_ENTRY_MAX_SIZE, CKeyHolderStorage::ReturnAll(), and vecOutPointLocked.
Referenced by SubmitDenominate().
◆ ProcessMessage()
void CPrivateSendClientSession::ProcessMessage | ( | CNode * | pfrom, |
const std::string & | strCommand, | ||
CDataStream & | vRecv, | ||
CConnman & | connman | ||
) |
Definition at line 134 of file privatesend-client.cpp.
References CNode::addr, CompletedTransaction(), deserialize, NetMsgType::DSCOMPLETE, NetMsgType::DSFINALTX, NetMsgType::DSSTATUSUPDATE, CPrivateSendClientManager::fEnablePrivateSend, fMasternodeMode, g_enable_bip61, CNode::GetId(), CPrivateSend::GetMessageByID(), CNode::GetSendVersion(), CMasternodeSync::IsBlockchainSynced(), LogPrint, masternodeSync, MIN_PRIVATESEND_PEER_PROTO_VERSION, mixingMasternode, MSG_POOL_MAX, CPrivateSendBaseSession::nSessionID, CNode::nVersion, BCLog::PRIVATESEND, privateSendClient, ProcessPoolStateUpdate(), CConnman::PushMessage(), NetMsgType::REJECT, REJECT_OBSOLETE, SignFinalTransaction(), strprintf, CService::ToString(), and CTransaction::ToString().
◆ ProcessPendingDsaRequest()
bool CPrivateSendClientSession::ProcessPendingDsaRequest | ( | CConnman & | connman | ) |
Definition at line 1153 of file privatesend-client.cpp.
References NetMsgType::DSACCEPT, CConnman::ForNode(), CPendingDsaRequest::GetAddr(), CPendingDsaRequest::GetDSA(), GetTime(), CPendingDsaRequest::IsExpired(), LogPrint, CPrivateSendBaseSession::nTimeLastSuccessfulStep, pendingDsaRequest, BCLog::PRIVATESEND, CConnman::PushMessage(), SetNull(), and CService::ToString().
◆ ProcessPoolStateUpdate()
|
private |
Process Masternode updates about the progress of mixing.
Definition at line 473 of file privatesend-client.cpp.
References _(), fMasternodeMode, CPrivateSend::GetMessageByID(), GetTime(), keyHolderStorage, LogPrint, MSG_POOL_MAX, MSG_POOL_MIN, CPrivateSendStatusUpdate::nMessageID, CPrivateSendStatusUpdate::nSessionID, CPrivateSendBaseSession::nSessionID, CPrivateSendStatusUpdate::nState, CPrivateSendBaseSession::nState, CPrivateSendStatusUpdate::nStatusUpdate, CPrivateSendBaseSession::nTimeLastSuccessfulStep, POOL_STATE_ERROR, POOL_STATE_IDLE, POOL_STATE_MAX, POOL_STATE_MIN, POOL_STATE_QUEUE, BCLog::PRIVATESEND, CKeyHolderStorage::ReturnAll(), SetState(), STATUS_ACCEPTED, STATUS_REJECTED, strAutoDenomResult, strLastMessage, strprintf, and UnlockCoins().
Referenced by ProcessMessage().
◆ RelayIn()
|
private |
Definition at line 1674 of file privatesend-client.cpp.
References CConnman::ForNode(), and mixingMasternode.
Referenced by SendDenominate().
◆ ResetPool()
void CPrivateSendClientSession::ResetPool | ( | ) |
Definition at line 228 of file privatesend-client.cpp.
References keyHolderStorage, CKeyHolderStorage::ReturnAll(), SetNull(), txMyCollateral, and UnlockCoins().
◆ SelectDenominate()
|
private |
step 0: select denominated inputs and txouts
Definition at line 1239 of file privatesend-client.cpp.
References CPrivateSendClientManager::fEnablePrivateSend, CPrivateSendClientManager::fPrivateSendRunning, CPrivateSendBaseSession::GetEntriesCount(), CPrivateSend::GetMaxPoolAmount(), GetWallets(), CPrivateSendBaseSession::nSessionDenom, and privateSendClient.
Referenced by SubmitDenominate().
◆ SendDenominate()
|
private |
step 2: send denominated inputs and outputs prepared in step 1
Definition at line 417 of file privatesend-client.cpp.
References CheckDiskSpace(), fMasternodeMode, GetTime(), keyHolderStorage, LogPrint, CPrivateSendBaseSession::nSessionID, CPrivateSendBaseSession::nTimeLastSuccessfulStep, POOL_STATE_ACCEPTING_ENTRIES, BCLog::PRIVATESEND, RelayIn(), CKeyHolderStorage::ReturnAll(), SetNull(), SetState(), strLastMessage, CMutableTransaction::ToString(), txMyCollateral, UnlockCoins(), CPrivateSendBaseSession::vecEntries, CMutableTransaction::vin, and CMutableTransaction::vout.
Referenced by SubmitDenominate().
◆ SetNull()
|
private |
Definition at line 247 of file privatesend-client.cpp.
References mixingMasternode, pendingDsaRequest, and CPrivateSendBaseSession::SetNull().
Referenced by CheckTimeout(), CompletedTransaction(), DoAutomaticDenominating(), ProcessPendingDsaRequest(), ResetPool(), SendDenominate(), and SignFinalTransaction().
◆ SetState()
|
private |
Definition at line 1686 of file privatesend-client.cpp.
References LogPrint, CPrivateSendBaseSession::nState, and BCLog::PRIVATESEND.
Referenced by CheckTimeout(), JoinExistingQueue(), ProcessPoolStateUpdate(), SendDenominate(), SignFinalTransaction(), and StartNewQueue().
◆ SignFinalTransaction()
|
private |
As a client, check and sign the final transaction.
Definition at line 525 of file privatesend-client.cpp.
References NetMsgType::DSSIGNFINALTX, CPrivateSendClientManager::fEnablePrivateSend, CPrivateSendBaseSession::finalMutableTransaction, fMasternodeMode, CPrivateSendClientManager::fPrivateSendRunning, CTransaction::GetHash(), CMutableTransaction::GetHash(), CPrivateSend::GetMessageByID(), CNode::GetSendVersion(), GetTime(), GetWallets(), CPrivateSendBaseSession::IsValidInOuts(), keyHolderStorage, LogPrint, mixingMasternode, MSG_NOERR, CPrivateSendBaseSession::nTimeLastSuccessfulStep, POOL_STATE_SIGNING, BCLog::PRIVATESEND, privateSendClient, CConnman::PushMessage(), CKeyHolderStorage::ReturnAll(), ScriptToAsmStr(), SetNull(), SetState(), SIGHASH_ALL, SIGHASH_ANYONECANPAY, SignSignature(), CMutableTransaction::ToString(), UnlockCoins(), CPrivateSendBaseSession::vecEntries, CMutableTransaction::vin, and CMutableTransaction::vout.
Referenced by ProcessMessage().
◆ StartNewQueue()
|
private |
Definition at line 1073 of file privatesend-client.cpp.
References _(), CConnman::AddPendingMasternode(), CPrivateSendClientManager::AddUsedMasternode(), CPrivateSend::AmountToDenomination(), CPrivateSend::DenominationToString(), deterministicMNManager, CPrivateSendClientManager::fEnablePrivateSend, CPrivateSendClientManager::fPrivateSendRunning, CMasternodeMetaMan::GetDsqCount(), CMasternodeMetaMan::GetDsqThreshold(), CMasternodeMetaMan::GetMetaInfo(), GetRandInt(), CPrivateSendClientManager::GetRandomNotUsedMasternode(), GetTime(), GetWallets(), CConnman::IsMasternodeOrDisconnectRequested(), LogPrint, mixingMasternode, mmetaman, CPrivateSendBaseSession::nSessionDenom, CPrivateSendBaseSession::nTimeLastSuccessfulStep, pendingDsaRequest, POOL_STATE_QUEUE, BCLog::PRIVATESEND, privateSendClient, SetState(), strAutoDenomResult, and txMyCollateral.
Referenced by DoAutomaticDenominating().
◆ SubmitDenominate()
bool CPrivateSendClientSession::SubmitDenominate | ( | CConnman & | connman | ) |
As a client, submit part of a future mixing transaction to a Masternode to start the process.
Definition at line 1187 of file privatesend-client.cpp.
References CTxMemPool::cs, cs_main, GetWallets(), LOCK, LOCK2, LogPrint, mempool, CPrivateSendClientManager::nPrivateSendRandomRounds, CPrivateSendClientManager::nPrivateSendRounds, CPrivateSendBaseSession::nSessionDenom, PrepareDenominate(), BCLog::PRIVATESEND, privateSendClient, SelectDenominate(), SendDenominate(), and strAutoDenomResult.
◆ UnlockCoins()
void CPrivateSendClientSession::UnlockCoins | ( | ) |
Definition at line 259 of file privatesend-client.cpp.
References CPrivateSendClientManager::fEnablePrivateSend, GetWallets(), MilliSleep(), privateSendClient, TRY_LOCK, and vecOutPointLocked.
Referenced by CheckTimeout(), CompletedTransaction(), DoAutomaticDenominating(), ProcessPoolStateUpdate(), ResetPool(), SendDenominate(), and SignFinalTransaction().
Member Data Documentation
◆ keyHolderStorage
|
private |
Definition at line 113 of file privatesend-client.h.
Referenced by CheckTimeout(), CompletedTransaction(), DoAutomaticDenominating(), PrepareDenominate(), ProcessPoolStateUpdate(), ResetPool(), SendDenominate(), and SignFinalTransaction().
◆ mixingMasternode
|
private |
Definition at line 109 of file privatesend-client.h.
Referenced by GetJsonInfo(), GetMixingMasternodeInfo(), JoinExistingQueue(), ProcessMessage(), RelayIn(), SetNull(), SignFinalTransaction(), and StartNewQueue().
◆ pendingDsaRequest
|
private |
Definition at line 111 of file privatesend-client.h.
Referenced by JoinExistingQueue(), ProcessPendingDsaRequest(), SetNull(), and StartNewQueue().
◆ strAutoDenomResult
|
private |
Definition at line 107 of file privatesend-client.h.
Referenced by DoAutomaticDenominating(), GetStatus(), JoinExistingQueue(), ProcessPoolStateUpdate(), StartNewQueue(), and SubmitDenominate().
◆ strLastMessage
|
private |
Definition at line 106 of file privatesend-client.h.
Referenced by CheckTimeout(), CompletedTransaction(), GetStatus(), ProcessPoolStateUpdate(), and SendDenominate().
◆ txMyCollateral
|
private |
Definition at line 110 of file privatesend-client.h.
Referenced by DoAutomaticDenominating(), JoinExistingQueue(), ResetPool(), SendDenominate(), and StartNewQueue().
◆ vecOutPointLocked
|
private |
Definition at line 104 of file privatesend-client.h.
Referenced by DoAutomaticDenominating(), PrepareDenominate(), and UnlockCoins().
The documentation for this class was generated from the following files:
- src/privatesend/privatesend-client.h
- src/privatesend/privatesend-client.cpp