Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
Used to keep track of current status of mixing pool. More...
#include <privatesend-server.h>
Public Member Functions | |
CPrivateSendServer () | |
void | ProcessMessage (CNode *pfrom, const std::string &strCommand, CDataStream &vRecv, CConnman &connman) |
bool | HasTimedOut () |
void | CheckTimeout (CConnman &connman) |
void | CheckForCompleteQueue (CConnman &connman) |
void | DoMaintenance (CConnman &connman) |
void | GetJsonInfo (UniValue &obj) const |
Public Member Functions inherited from CPrivateSendBaseSession | |
CPrivateSendBaseSession () | |
int | GetState () const |
std::string | GetStateString () const |
int | GetEntriesCount () const |
Public Member Functions inherited from CPrivateSendBaseManager | |
CPrivateSendBaseManager () | |
int | GetQueueSize () const |
bool | GetQueueItemAndTry (CPrivateSendQueue &dsqRet) |
Private Member Functions | |
bool | AddEntry (CConnman &connman, const CPrivateSendEntry &entry, PoolMessage &nMessageIDRet) |
Add a clients entry to the pool. More... | |
bool | AddScriptSig (const CTxIn &txin) |
Add signature to a txin. More... | |
void | ChargeFees (CConnman &connman) |
Charge fees to bad actors (Charge clients a fee if they're abusive) More... | |
void | ChargeRandomFees (CConnman &connman) |
Rarely charge fees to pay miners. More... | |
void | ConsumeCollateral (CConnman &connman, const CTransactionRef &txref) |
Consume collateral in cases when peer misbehaved. More... | |
void | CheckPool (CConnman &connman) |
Check for process. More... | |
void | CreateFinalTransaction (CConnman &connman) |
void | CommitFinalTransaction (CConnman &connman) |
bool | IsAcceptableDSA (const CPrivateSendAccept &dsa, PoolMessage &nMessageIDRet) |
Is this nDenom and txCollateral acceptable? More... | |
bool | CreateNewSession (const CPrivateSendAccept &dsa, PoolMessage &nMessageIDRet, CConnman &connman) |
bool | AddUserToExistingSession (const CPrivateSendAccept &dsa, PoolMessage &nMessageIDRet) |
bool | IsSessionReady () |
Do we have enough users to take entries? More... | |
bool | IsSignaturesComplete () |
Check that all inputs are signed. (Are all inputs signed?) More... | |
bool | IsInputScriptSigValid (const CTxIn &txin) |
Check to make sure a given input matches an input in the pool and its scriptSig is valid. More... | |
void | SetState (PoolState nStateNew) |
void | RelayFinalTransaction (const CTransaction &txFinal, CConnman &connman) |
Relay mixing Messages. More... | |
void | PushStatus (CNode *pnode, PoolStatusUpdate nStatusUpdate, PoolMessage nMessageID, CConnman &connman) |
void | RelayStatus (PoolStatusUpdate nStatusUpdate, CConnman &connman, PoolMessage nMessageID=MSG_NOERR) |
void | RelayCompletedTransaction (PoolMessage nMessageID, CConnman &connman) |
void | SetNull () |
Private Attributes | |
std::vector< CTransactionRef > | vecSessionCollaterals |
bool | fUnitTest |
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 Member Functions inherited from CPrivateSendBaseManager | |
void | SetNull () |
void | CheckQueue () |
Protected Attributes inherited from CPrivateSendBaseSession | |
CCriticalSection | cs_privatesend |
std::vector< CPrivateSendEntry > | vecEntries |
PoolState | nState |
int64_t | nTimeLastSuccessfulStep |
int | nSessionID |
CMutableTransaction | finalMutableTransaction |
Protected Attributes inherited from CPrivateSendBaseManager | |
CCriticalSection | cs_vecqueue |
std::vector< CPrivateSendQueue > | vecPrivateSendQueue |
Detailed Description
Used to keep track of current status of mixing pool.
Definition at line 19 of file privatesend-server.h.
Constructor & Destructor Documentation
◆ CPrivateSendServer()
|
inline |
Definition at line 70 of file privatesend-server.h.
Member Function Documentation
◆ AddEntry()
|
private |
Add a clients entry to the pool.
Definition at line 556 of file privatesend-server.cpp.
References ConsumeCollateral(), ERR_ALREADY_HAVE, ERR_ENTRIES_FULL, ERR_INVALID_COLLATERAL, ERR_MAXIMUM, fMasternodeMode, CPrivateSendBaseSession::GetEntriesCount(), CPrivateSend::GetMaxPoolParticipants(), CPrivateSend::GetMessageByID(), CPrivateSend::IsCollateralValid(), CPrivateSendBaseSession::IsValidInOuts(), LogPrint, MSG_ENTRIES_ADDED, BCLog::PRIVATESEND, PRIVATESEND_ENTRY_MAX_SIZE, CPrivateSendEntry::txCollateral, CPrivateSendBaseSession::vecEntries, vecSessionCollaterals, CPrivateSendEntry::vecTxDSIn, and CPrivateSendEntry::vecTxOut.
Referenced by ProcessMessage().
◆ AddScriptSig()
|
private |
Add signature to a txin.
Definition at line 615 of file privatesend-server.cpp.
References CPrivateSendBaseSession::finalMutableTransaction, CPrivateSendBaseSession::GetEntriesCount(), IsInputScriptSigValid(), LogPrint, CTxIn::nSequence, CTxIn::prevout, BCLog::PRIVATESEND, CTxIn::scriptSig, ScriptToAsmStr(), CPrivateSendBaseSession::vecEntries, and CMutableTransaction::vin.
Referenced by ProcessMessage().
◆ AddUserToExistingSession()
|
private |
Definition at line 723 of file privatesend-server.cpp.
References CPrivateSend::DenominationToString(), ERR_DENOM, ERR_MODE, fMasternodeMode, CPrivateSend::GetMaxPoolParticipants(), IsAcceptableDSA(), IsSessionReady(), LogPrint, MakeTransactionRef(), MSG_NOERR, CPrivateSendAccept::nDenom, CPrivateSendBaseSession::nSessionDenom, CPrivateSendBaseSession::nSessionID, CPrivateSendBaseSession::nState, POOL_STATE_QUEUE, BCLog::PRIVATESEND, CPrivateSendAccept::txCollateral, and vecSessionCollaterals.
Referenced by ProcessMessage().
◆ ChargeFees()
|
private |
Charge fees to bad actors (Charge clients a fee if they're abusive)
Definition at line 368 of file privatesend-server.cpp.
References ConsumeCollateral(), fMasternodeMode, GetRandInt(), LogPrint, CPrivateSendBaseSession::nState, POOL_STATE_ACCEPTING_ENTRIES, POOL_STATE_SIGNING, BCLog::PRIVATESEND, CPrivateSendBaseSession::vecEntries, and vecSessionCollaterals.
Referenced by CheckPool(), and CheckTimeout().
◆ ChargeRandomFees()
|
private |
Rarely charge fees to pay miners.
Definition at line 438 of file privatesend-server.cpp.
References ConsumeCollateral(), fMasternodeMode, GetRandInt(), LogPrint, BCLog::PRIVATESEND, and vecSessionCollaterals.
Referenced by CommitFinalTransaction().
◆ CheckForCompleteQueue()
void CPrivateSendServer::CheckForCompleteQueue | ( | CConnman & | connman | ) |
Definition at line 495 of file privatesend-server.cpp.
References activeMasternodeInfo, fMasternodeMode, GetAdjustedTime(), IsSessionReady(), LogPrint, CPrivateSendBaseSession::nSessionDenom, CPrivateSendBaseSession::nState, CActiveMasternodeInfo::outpoint, POOL_STATE_ACCEPTING_ENTRIES, POOL_STATE_QUEUE, BCLog::PRIVATESEND, CPrivateSendQueue::Relay(), SetState(), CPrivateSendQueue::Sign(), CPrivateSendQueue::ToString(), and vecSessionCollaterals.
Referenced by DoMaintenance().
◆ CheckPool()
|
private |
Check for process.
Definition at line 249 of file privatesend-server.cpp.
References ChargeFees(), CommitFinalTransaction(), CreateFinalTransaction(), fMasternodeMode, CPrivateSendBaseSession::GetEntriesCount(), CPrivateSend::GetMinPoolParticipants(), HasTimedOut(), IsSignaturesComplete(), LogPrint, CPrivateSendBaseSession::nState, POOL_STATE_ACCEPTING_ENTRIES, POOL_STATE_SIGNING, BCLog::PRIVATESEND, and vecSessionCollaterals.
Referenced by DoMaintenance(), and ProcessMessage().
◆ CheckTimeout()
void CPrivateSendServer::CheckTimeout | ( | CConnman & | connman | ) |
Definition at line 475 of file privatesend-server.cpp.
References ChargeFees(), CPrivateSendBaseManager::CheckQueue(), fMasternodeMode, HasTimedOut(), LogPrint, CPrivateSendBaseSession::nState, POOL_STATE_SIGNING, BCLog::PRIVATESEND, and SetNull().
Referenced by DoMaintenance().
◆ CommitFinalTransaction()
|
private |
Definition at line 308 of file privatesend-server.cpp.
References AcceptToMemoryPool(), activeMasternodeInfo, CPrivateSend::AddDSTX(), ChargeRandomFees(), COIN, cs_main, ERR_INVALID_TX, CPrivateSendBaseSession::finalMutableTransaction, fMasternodeMode, GetAdjustedTime(), CPrivateSend::GetDSTX(), LogPrint, MakeTransactionRef(), maxTxFee, mempool, MSG_DSTX, MSG_SUCCESS, CActiveMasternodeInfo::outpoint, CTxMemPool::PrioritiseTransaction(), BCLog::PRIVATESEND, RelayCompletedTransaction(), CConnman::RelayInv(), SetNull(), CPrivateSendBroadcastTx::Sign(), and TRY_LOCK.
Referenced by CheckPool().
◆ ConsumeCollateral()
|
private |
Consume collateral in cases when peer misbehaved.
Definition at line 449 of file privatesend-server.cpp.
References AcceptToMemoryPool(), cs_main, LOCK, LogPrint, mempool, BCLog::PRIVATESEND, and CConnman::RelayTransaction().
Referenced by AddEntry(), ChargeFees(), and ChargeRandomFees().
◆ CreateFinalTransaction()
|
private |
Definition at line 281 of file privatesend-server.cpp.
References CPrivateSendBaseSession::finalMutableTransaction, CPrivateSendBaseSession::GetEntriesCount(), LogPrint, POOL_STATE_SIGNING, BCLog::PRIVATESEND, RelayFinalTransaction(), SetState(), CMutableTransaction::ToString(), CPrivateSendBaseSession::vecEntries, CMutableTransaction::vin, and CMutableTransaction::vout.
Referenced by CheckPool().
◆ CreateNewSession()
|
private |
Definition at line 685 of file privatesend-server.cpp.
References activeMasternodeInfo, CPrivateSend::DenominationToString(), ERR_MODE, fMasternodeMode, fUnitTest, GetAdjustedTime(), CPrivateSend::GetMaxPoolParticipants(), GetRandInt(), IsAcceptableDSA(), LogPrint, MakeTransactionRef(), MSG_NOERR, CPrivateSendAccept::nDenom, CPrivateSendBaseSession::nSessionDenom, CPrivateSendBaseSession::nSessionID, CPrivateSendBaseSession::nState, CActiveMasternodeInfo::outpoint, POOL_STATE_IDLE, POOL_STATE_QUEUE, BCLog::PRIVATESEND, CPrivateSendQueue::Relay(), SetState(), CPrivateSendQueue::Sign(), CPrivateSendQueue::ToString(), CPrivateSendAccept::txCollateral, CPrivateSendBaseManager::vecPrivateSendQueue, and vecSessionCollaterals.
Referenced by ProcessMessage().
◆ DoMaintenance()
void CPrivateSendServer::DoMaintenance | ( | CConnman & | connman | ) |
Definition at line 870 of file privatesend-server.cpp.
References CheckForCompleteQueue(), CheckPool(), CheckTimeout(), fMasternodeMode, CMasternodeSync::IsBlockchainSynced(), masternodeSync, privateSendServer, and ShutdownRequested().
Referenced by AppInitMain().
◆ GetJsonInfo()
void CPrivateSendServer::GetJsonInfo | ( | UniValue & | obj | ) | const |
Definition at line 881 of file privatesend-server.cpp.
References UniValue::clear(), CPrivateSend::DenominationToAmount(), CPrivateSendBaseSession::GetEntriesCount(), CPrivateSendBaseManager::GetQueueSize(), CPrivateSendBaseSession::GetStateString(), CPrivateSendBaseSession::nSessionDenom, Pair(), UniValue::push_back(), UniValue::setObject(), and ValueFromAmount().
Referenced by getprivatesendinfo().
◆ HasTimedOut()
bool CPrivateSendServer::HasTimedOut | ( | ) |
Definition at line 461 of file privatesend-server.cpp.
References fMasternodeMode, GetTime(), CPrivateSendBaseSession::nState, CPrivateSendBaseSession::nTimeLastSuccessfulStep, POOL_STATE_IDLE, POOL_STATE_SIGNING, PRIVATESEND_QUEUE_TIMEOUT, and PRIVATESEND_SIGNING_TIMEOUT.
Referenced by CheckPool(), CheckTimeout(), and IsSessionReady().
◆ IsAcceptableDSA()
|
private |
Is this nDenom and txCollateral acceptable?
Definition at line 664 of file privatesend-server.cpp.
References ERR_DENOM, ERR_INVALID_COLLATERAL, fMasternodeMode, fUnitTest, CPrivateSend::IsCollateralValid(), CPrivateSend::IsValidDenomination(), LogPrint, CPrivateSendAccept::nDenom, BCLog::PRIVATESEND, and CPrivateSendAccept::txCollateral.
Referenced by AddUserToExistingSession(), and CreateNewSession().
◆ IsInputScriptSigValid()
|
private |
Check to make sure a given input matches an input in the pool and its scriptSig is valid.
Definition at line 511 of file privatesend-server.cpp.
References LogPrint, CTxIn::prevout, BCLog::PRIVATESEND, SCRIPT_VERIFY_P2SH, SCRIPT_VERIFY_STRICTENC, CTxIn::scriptSig, ScriptToAsmStr(), CTxIn::ToString(), CPrivateSendBaseSession::vecEntries, VerifyScript(), CMutableTransaction::vin, and CMutableTransaction::vout.
Referenced by AddScriptSig().
◆ IsSessionReady()
|
private |
Do we have enough users to take entries?
Definition at line 757 of file privatesend-server.cpp.
References CPrivateSend::GetMaxPoolParticipants(), CPrivateSend::GetMinPoolParticipants(), HasTimedOut(), CPrivateSendBaseSession::nState, POOL_STATE_ACCEPTING_ENTRIES, POOL_STATE_QUEUE, and vecSessionCollaterals.
Referenced by AddUserToExistingSession(), CheckForCompleteQueue(), and ProcessMessage().
◆ IsSignaturesComplete()
|
private |
Check that all inputs are signed. (Are all inputs signed?)
Definition at line 653 of file privatesend-server.cpp.
References CPrivateSendBaseSession::vecEntries.
Referenced by CheckPool().
◆ ProcessMessage()
void CPrivateSendServer::ProcessMessage | ( | CNode * | pfrom, |
const std::string & | strCommand, | ||
CDataStream & | vRecv, | ||
CConnman & | connman | ||
) |
Definition at line 27 of file privatesend-server.cpp.
References activeMasternodeInfo, AddEntry(), CNode::addr, AddScriptSig(), AddUserToExistingSession(), CMasternodeMetaMan::AllowMixing(), CheckPool(), CreateNewSession(), cs_main, CPrivateSendBaseManager::cs_vecqueue, CPrivateSend::DenominationToString(), deterministicMNManager, NetMsgType::DSACCEPT, NetMsgType::DSQUEUE, NetMsgType::DSSIGNFINALTX, NetMsgType::DSVIN, ERR_MN_LIST, ERR_QUEUE_FULL, ERR_RECENT, ERR_SESSION, ERR_VERSION, fLogIPs, fMasternodeMode, g_enable_bip61, CMasternodeMetaMan::GetDsqCount(), CMasternodeMetaMan::GetDsqThreshold(), CNode::GetId(), CNode::GetLogString(), CMasternodeMetaMan::GetMetaInfo(), CNode::GetSendVersion(), CMasternodeSync::IsBlockchainSynced(), IsSessionReady(), LOCK, LogPrint, masternodeSync, MIN_PRIVATESEND_PEER_PROTO_VERSION, Misbehaving(), mmetaman, MSG_NOERR, CPrivateSendBaseSession::nSessionID, CNode::nVersion, CActiveMasternodeInfo::outpoint, BCLog::PRIVATESEND, CConnman::PushMessage(), PushStatus(), NetMsgType::REJECT, REJECT_OBSOLETE, RelayStatus(), STATUS_ACCEPTED, STATUS_REJECTED, strprintf, CService::ToString(), TRY_LOCK, CPrivateSendBaseManager::vecPrivateSendQueue, and vecSessionCollaterals.
Referenced by ProcessMessage().
◆ PushStatus()
|
private |
Definition at line 793 of file privatesend-server.cpp.
References NetMsgType::DSSTATUSUPDATE, CNode::GetSendVersion(), CPrivateSendBaseSession::nSessionID, CPrivateSendBaseSession::nState, and CConnman::PushMessage().
Referenced by ProcessMessage().
◆ RelayCompletedTransaction()
|
private |
Definition at line 836 of file privatesend-server.cpp.
References CPrivateSend::DenominationToString(), CConnman::ForNode(), LogPrint, CPrivateSendBaseSession::nSessionDenom, CPrivateSendBaseSession::nSessionID, BCLog::PRIVATESEND, RelayStatus(), STATUS_REJECTED, and CPrivateSendBaseSession::vecEntries.
Referenced by CommitFinalTransaction().
◆ RelayFinalTransaction()
|
private |
Relay mixing Messages.
Definition at line 773 of file privatesend-server.cpp.
References CPrivateSend::DenominationToString(), CConnman::ForNode(), LogPrint, CPrivateSendBaseSession::nSessionDenom, CPrivateSendBaseSession::nSessionID, BCLog::PRIVATESEND, RelayStatus(), STATUS_REJECTED, and CPrivateSendBaseSession::vecEntries.
Referenced by CreateFinalTransaction().
◆ RelayStatus()
|
private |
Definition at line 800 of file privatesend-server.cpp.
References CPrivateSend::DenominationToString(), CConnman::ForNode(), LogPrint, CPrivateSendBaseSession::nSessionDenom, CPrivateSendBaseSession::nSessionID, BCLog::PRIVATESEND, SetNull(), and CPrivateSendBaseSession::vecEntries.
Referenced by ProcessMessage(), RelayCompletedTransaction(), and RelayFinalTransaction().
◆ SetNull()
|
private |
Definition at line 237 of file privatesend-server.cpp.
References CPrivateSendBaseSession::SetNull(), CPrivateSendBaseManager::SetNull(), and vecSessionCollaterals.
Referenced by CheckTimeout(), CommitFinalTransaction(), and RelayStatus().
◆ SetState()
|
private |
Definition at line 856 of file privatesend-server.cpp.
References fMasternodeMode, GetTime(), LogPrint, CPrivateSendBaseSession::nState, CPrivateSendBaseSession::nTimeLastSuccessfulStep, POOL_STATE_ERROR, and BCLog::PRIVATESEND.
Referenced by CheckForCompleteQueue(), CreateFinalTransaction(), and CreateNewSession().
Member Data Documentation
◆ fUnitTest
|
private |
Definition at line 26 of file privatesend-server.h.
Referenced by CreateNewSession(), and IsAcceptableDSA().
◆ vecSessionCollaterals
|
private |
Definition at line 24 of file privatesend-server.h.
Referenced by AddEntry(), AddUserToExistingSession(), ChargeFees(), ChargeRandomFees(), CheckForCompleteQueue(), CheckPool(), CreateNewSession(), IsSessionReady(), ProcessMessage(), and SetNull().
The documentation for this class was generated from the following files:
- src/privatesend/privatesend-server.h
- src/privatesend/privatesend-server.cpp