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

Method SendDarksendDenominate

src/darksend.cpp:1120–1188  ·  view source on GitHub ↗

Execute a darksend denomination via a masternode. This is only ran from clients

Source from the content-addressed store, hash-verified

1118// This is only ran from clients
1119//
1120void CDarkSendPool::SendDarksendDenominate(std::vector <CTxIn>& vin, std::vector <CTxOut>& vout, int64_t amount) {
1121 if (darkSendPool.txCollateral == CMutableTransaction()) {
1122 LogPrintf ("CDarksendPool:SendDarksendDenominate() - Darksend collateral not set");
1123 return;
1124 }
1125
1126 // lock the funds we're going to use
1127 for (CTxIn in : txCollateral.vin)
1128 lockedCoins.push_back(in);
1129
1130 for (CTxIn in : vin)
1131 lockedCoins.push_back(in);
1132
1133 // we should already be connected to a masternode
1134 if (!sessionFoundMasternode) {
1135 LogPrintf("CDarkSendPool::SendDarksendDenominate() - No masternode has been selected yet.\n");
1136 UnlockCoins();
1137 SetNull(true);
1138 return;
1139 }
1140
1141 if (!CheckDiskSpace())
1142 return;
1143
1144 if (fMasterNode) {
1145 LogPrintf("CDarkSendPool::SendDarksendDenominate() - DarkSend from a masternode is not supported currently.\n");
1146 return;
1147 }
1148
1149 UpdateState(POOL_STATUS_ACCEPTING_ENTRIES);
1150
1151 LogPrintf("CDarkSendPool::SendDarksendDenominate() - Added transaction to pool.\n");
1152
1153 ClearLastMessage();
1154
1155 //check it against the memory pool to make sure it's valid
1156 {
1157 int64_t nValueOut = 0;
1158
1159 CValidationState state;
1160 CMutableTransaction tx;
1161
1162 for (const CTxOut o : vout) {
1163 nValueOut += o.nValue;
1164 tx.vout.push_back(o);
1165 }
1166
1167 for (const CTxIn i : vin) {
1168 tx.vin.push_back(i);
1169
1170 if (fDebug) LogPrintf("dsi -- tx in %s\n", i.ToString().c_str());
1171 }
1172
1173 bool* pfMissingInputs = nullptr;
1174 if (!AcceptableInputs(mempool, state, CTransaction(tx), false, pfMissingInputs)) {
1175 LogPrintf("dsi -- transaction not valid! %s \n", tx.ToString().c_str());
1176 return;
1177 }

Callers 1

Calls 9

CheckDiskSpaceFunction · 0.85
AcceptableInputsFunction · 0.85
RelayDarkSendInFunction · 0.85
CheckFunction · 0.85
CMutableTransactionClass · 0.70
CTransactionClass · 0.70
push_backMethod · 0.45
ToStringMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected