A couple of minor improvements in IS code (#3114)

* check if we can lock before checking if it is conflicting, it is very rare a tx will actually be conflicting, whereas it is very common that a MN will not be able to sign for a specific Tx

Signed-off-by: Pasta <pasta@dashboost.org>

* remove unused variable

Signed-off-by: Pasta <pasta@dashboost.org>

* move sync check higher up

Signed-off-by: Pasta <pasta@dashboost.org>

* remove unused/unnecessary variable

Signed-off-by: Pasta <pasta@dashboost.org>

* remove unused variable

Signed-off-by: Pasta <pasta@dashboost.org>

* Revert "move sync check higher up"

This reverts commit 77fbe054df78b8bb12f686a627ef618ecff7e7a1.
This commit is contained in:
PastaPastaPasta 2019-09-27 18:25:45 +00:00 committed by Alexander Block
parent 43b7c31d96
commit c5da938518

View File

@ -402,11 +402,11 @@ bool CInstantSendManager::ProcessTx(const CTransaction& tx, const Consensus::Par
g_connman->RelayInvFiltered(inv, tx, LLMQS_PROTO_VERSION);
}
if (IsConflicted(tx)) {
if (!CheckCanLock(tx, true, params)) {
return false;
}
if (!CheckCanLock(tx, true, params)) {
if (IsConflicted(tx)) {
return false;
}
@ -461,14 +461,11 @@ bool CInstantSendManager::CheckCanLock(const CTransaction& tx, bool printDebug,
return false;
}
CAmount nValueIn = 0;
for (const auto& in : tx.vin) {
CAmount v = 0;
if (!CheckCanLock(in.prevout, printDebug, tx.GetHash(), &v, params)) {
return false;
}
nValueIn += v;
}
return true;
@ -560,8 +557,6 @@ void CInstantSendManager::HandleNewRecoveredSig(const CRecoveredSig& recoveredSi
void CInstantSendManager::HandleNewInputLockRecoveredSig(const CRecoveredSig& recoveredSig, const uint256& txid)
{
auto llmqType = Params().GetConsensus().llmqTypeInstantSend;
CTransactionRef tx;
uint256 hashBlock;
if (!GetTransaction(txid, tx, Params().GetConsensus(), hashBlock, true)) {
@ -958,8 +953,6 @@ void CInstantSendManager::ProcessNewTransaction(const CTransactionRef& tx, const
return;
}
bool inMempool = mempool.get(tx->GetHash()) != nullptr;
uint256 islockHash;
{
LOCK(cs);