Accept non-spent LLMQ IS locked outpoints from mempool in PS mixing (#2878)

This commit is contained in:
UdjinM6 2019-04-29 11:32:08 +03:00 committed by GitHub
parent 2652030a2b
commit 7f419ae7fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 3 deletions

View File

@ -18,6 +18,8 @@
#include "utilmoneystr.h"
#include "validation.h"
#include "llmq/quorums_instantsend.h"
CPrivateSendServer privateSendServer;
void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman)
@ -217,7 +219,15 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm
LogPrint("privatesend", "DSVIN -- txin=%s\n", txin.ToString());
Coin coin;
if (GetUTXOCoin(txin.prevout, coin)) {
auto mempoolTx = mempool.get(txin.prevout.hash);
if (mempoolTx != nullptr) {
if (mempool.isSpent(txin.prevout) || !llmq::quorumInstantSendManager->IsLocked(txin.prevout.hash)) {
LogPrintf("DSVIN -- spent or non-locked mempool input! txin=%s\n", txin.ToString());
PushStatus(pfrom, STATUS_REJECTED, ERR_MISSING_TX, connman);
return;
}
nValueIn += mempoolTx->vout[txin.prevout.n].nValue;
} else if (GetUTXOCoin(txin.prevout, coin)) {
nValueIn += coin.out.nValue;
} else {
LogPrintf("DSVIN -- missing input! txin=%s\n", txin.ToString());

View File

@ -16,6 +16,8 @@
#include "utilmoneystr.h"
#include "validation.h"
#include "llmq/quorums_instantsend.h"
#include <string>
bool CPrivateSendEntry::AddScriptSig(const CTxIn& txin)
@ -238,11 +240,19 @@ bool CPrivateSend::IsCollateralValid(const CTransaction& txCollateral)
for (const auto& txin : txCollateral.vin) {
Coin coin;
if (!GetUTXOCoin(txin.prevout, coin)) {
auto mempoolTx = mempool.get(txin.prevout.hash);
if (mempoolTx != nullptr) {
if (mempool.isSpent(txin.prevout) || !llmq::quorumInstantSendManager->IsLocked(txin.prevout.hash)) {
LogPrint("privatesend", "CPrivateSend::IsCollateralValid -- spent or non-locked mempool input! txin=%s\n", txin.ToString());
return false;
}
nValueIn += mempoolTx->vout[txin.prevout.n].nValue;
} else if (GetUTXOCoin(txin.prevout, coin)) {
nValueIn += coin.out.nValue;
} else {
LogPrint("privatesend", "CPrivateSend::IsCollateralValid -- Unknown inputs in collateral transaction, txCollateral=%s", txCollateral.ToString());
return false;
}
nValueIn += coin.out.nValue;
}
//collateral transactions are required to pay out a small fee to the miners