| 54 | */ |
| 55 | |
| 56 | void 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."); |
no test coverage detected