MCPcopy Create free account
hub / github.com/LUX-Core/lux / ProcessMessageDarksend

Function ProcessMessageDarksend

src/darksend.cpp:56–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54*/
55
56void ProcessMessageDarksend(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, bool& isDarksend) {
57 if (IsInitialBlockDownload()) return;
58
59 if (strCommand == "dsf") { //DarkSend Final tx
60 isDarksend = true;
61
62 if (pfrom->nVersion < darkSendPool.MIN_PEER_PROTO_VERSION) {
63 return;
64 }
65
66 if ((CNetAddr) darkSendPool.submittedToMasternode != (CNetAddr) pfrom->addr) {
67 //LogPrintf("dsc - message doesn't match current masternode - %s != %s\n", darkSendPool.submittedToMasternode.ToString().c_str(), pfrom->addr.ToString().c_str());
68 return;
69 }
70
71 int sessionID;
72 CTransaction txNew;
73 vRecv >> sessionID >> txNew;
74
75 if (darkSendPool.sessionID != sessionID) {
76 if (fDebug) LogPrintf("dsf - message doesn't match current darksend session %d %d\n", darkSendPool.sessionID, sessionID);
77 return;
78 }
79
80 //check to see if input is spent already? (and probably not confirmed)
81 darkSendPool.SignFinalTransaction(txNew, pfrom);
82 }
83
84 else if (strCommand == "dsc") { //DarkSend Complete
85 isDarksend = true;
86
87 if (pfrom->nVersion < darkSendPool.MIN_PEER_PROTO_VERSION) {
88 return;
89 }
90
91 if ((CNetAddr) darkSendPool.submittedToMasternode != (CNetAddr) pfrom->addr) {
92 //LogPrintf("dsc - message doesn't match current masternode - %s != %s\n", darkSendPool.submittedToMasternode.ToString().c_str(), pfrom->addr.ToString().c_str());
93 return;
94 }
95
96 int sessionID;
97 bool error;
98 std::string lastMessage;
99 vRecv >> sessionID >> error >> lastMessage;
100
101 if (darkSendPool.sessionID != sessionID) {
102 if (fDebug) LogPrintf("dsc - message doesn't match current darksend session %d %d\n", darkSendPool.sessionID, sessionID);
103 return;
104 }
105
106 darkSendPool.CompletedTransaction(error, lastMessage);
107 }
108
109 else if (strCommand == "dsa") { //DarkSend Acceptable
110 isDarksend = true;
111
112 if (pfrom->nVersion < darkSendPool.MIN_PEER_PROTO_VERSION) {
113 std::string strError = _("Incompatible version.");

Callers 1

ProcessMessageFunction · 0.85

Calls 15

IsInitialBlockDownloadFunction · 0.85
_Function · 0.85
GetMasternodeByVinFunction · 0.85
GetTimeFunction · 0.85
GetTransactionFunction · 0.85
AcceptableInputsFunction · 0.85
RelayDarkSendStatusFunction · 0.85
SignFinalTransactionMethod · 0.80
CompletedTransactionMethod · 0.80
PushMessageMethod · 0.80
GetStateMethod · 0.80

Tested by

no test coverage detected