Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

privatesend-server.h
Go to the documentation of this file.
1 // Copyright (c) 2014-2020 The Dash Core developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef PRIVATESENDSERVER_H
6 #define PRIVATESENDSERVER_H
7 
8 #include <net.h>
10 
11 class CPrivateSendServer;
12 class UniValue;
13 
14 // The main object for accessing mixing
16 
20 {
21 private:
22  // Mixing uses collateral transactions to trust parties entering the pool
23  // to behave honestly. If they don't it takes their money.
24  std::vector<CTransactionRef> vecSessionCollaterals;
25 
26  bool fUnitTest;
27 
29  bool AddEntry(CConnman& connman, const CPrivateSendEntry& entry, PoolMessage& nMessageIDRet);
31  bool AddScriptSig(const CTxIn& txin);
32 
34  void ChargeFees(CConnman& connman);
36  void ChargeRandomFees(CConnman& connman);
38  void ConsumeCollateral(CConnman& connman, const CTransactionRef& txref);
39 
41  void CheckPool(CConnman& connman);
42 
43  void CreateFinalTransaction(CConnman& connman);
44  void CommitFinalTransaction(CConnman& connman);
45 
47  bool IsAcceptableDSA(const CPrivateSendAccept& dsa, PoolMessage& nMessageIDRet);
48  bool CreateNewSession(const CPrivateSendAccept& dsa, PoolMessage& nMessageIDRet, CConnman& connman);
49  bool AddUserToExistingSession(const CPrivateSendAccept& dsa, PoolMessage& nMessageIDRet);
51  bool IsSessionReady();
52 
54  bool IsSignaturesComplete();
56  bool IsInputScriptSigValid(const CTxIn& txin);
57 
58  // Set the 'state' value, with some logging and capturing when the state changed
59  void SetState(PoolState nStateNew);
60 
62  void RelayFinalTransaction(const CTransaction& txFinal, CConnman& connman);
63  void PushStatus(CNode* pnode, PoolStatusUpdate nStatusUpdate, PoolMessage nMessageID, CConnman& connman);
64  void RelayStatus(PoolStatusUpdate nStatusUpdate, CConnman& connman, PoolMessage nMessageID = MSG_NOERR);
65  void RelayCompletedTransaction(PoolMessage nMessageID, CConnman& connman);
66 
67  void SetNull();
68 
69 public:
72  fUnitTest(false) {}
73 
74  void ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman);
75 
76  bool HasTimedOut();
77  void CheckTimeout(CConnman& connman);
78  void CheckForCompleteQueue(CConnman& connman);
79 
80  void DoMaintenance(CConnman& connman);
81 
82  void GetJsonInfo(UniValue& obj) const;
83 };
84 
85 #endif
bool AddEntry(CConnman &connman, const CPrivateSendEntry &entry, PoolMessage &nMessageIDRet)
Add a clients entry to the pool.
void CheckTimeout(CConnman &connman)
bool AddUserToExistingSession(const CPrivateSendAccept &dsa, PoolMessage &nMessageIDRet)
bool IsInputScriptSigValid(const CTxIn &txin)
Check to make sure a given input matches an input in the pool and its scriptSig is valid...
PoolMessage
Definition: privatesend.h:33
Double ended buffer combining vector and stream-like interfaces.
Definition: streams.h:103
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:345
void RelayFinalTransaction(const CTransaction &txFinal, CConnman &connman)
Relay mixing Messages.
false
Definition: bls_dkg.cpp:168
PoolState
Definition: privatesend.h:63
void ChargeRandomFees(CConnman &connman)
Rarely charge fees to pay miners.
void GetJsonInfo(UniValue &obj) const
An input of a transaction.
Definition: transaction.h:70
Definition: privatesend.h:173
void CheckPool(CConnman &connman)
Check for process.
bool CreateNewSession(const CPrivateSendAccept &dsa, PoolMessage &nMessageIDRet, CConnman &connman)
Definition: net.h:136
bool IsAcceptableDSA(const CPrivateSendAccept &dsa, PoolMessage &nMessageIDRet)
Is this nDenom and txCollateral acceptable?
void ProcessMessage(CNode *pfrom, const std::string &strCommand, CDataStream &vRecv, CConnman &connman)
void RelayStatus(PoolStatusUpdate nStatusUpdate, CConnman &connman, PoolMessage nMessageID=MSG_NOERR)
void CheckForCompleteQueue(CConnman &connman)
bool IsSessionReady()
Do we have enough users to take entries?
PoolStatusUpdate
Definition: privatesend.h:75
bool AddScriptSig(const CTxIn &txin)
Add signature to a txin.
void DoMaintenance(CConnman &connman)
bool IsSignaturesComplete()
Check that all inputs are signed. (Are all inputs signed?)
void PushStatus(CNode *pnode, PoolStatusUpdate nStatusUpdate, PoolMessage nMessageID, CConnman &connman)
void RelayCompletedTransaction(PoolMessage nMessageID, CConnman &connman)
Used to keep track of current status of mixing pool.
void SetState(PoolState nStateNew)
void CommitFinalTransaction(CConnman &connman)
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:198
Information about a peer.
Definition: net.h:800
CPrivateSendServer privateSendServer
void CreateFinalTransaction(CConnman &connman)
std::vector< CTransactionRef > vecSessionCollaterals
void ConsumeCollateral(CConnman &connman, const CTransactionRef &txref)
Consume collateral in cases when peer misbehaved.
void ChargeFees(CConnman &connman)
Charge fees to bad actors (Charge clients a fee if they&#39;re abusive)
Released under the MIT license