Skip to content

Commit c5da938

Browse files
PastaPastaPastacodablock
authored andcommitted
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 77fbe05.
1 parent 43b7c31 commit c5da938

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/llmq/quorums_instantsend.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -402,11 +402,11 @@ bool CInstantSendManager::ProcessTx(const CTransaction& tx, const Consensus::Par
402402
g_connman->RelayInvFiltered(inv, tx, LLMQS_PROTO_VERSION);
403403
}
404404

405-
if (IsConflicted(tx)) {
405+
if (!CheckCanLock(tx, true, params)) {
406406
return false;
407407
}
408408

409-
if (!CheckCanLock(tx, true, params)) {
409+
if (IsConflicted(tx)) {
410410
return false;
411411
}
412412

@@ -461,14 +461,11 @@ bool CInstantSendManager::CheckCanLock(const CTransaction& tx, bool printDebug,
461461
return false;
462462
}
463463

464-
CAmount nValueIn = 0;
465464
for (const auto& in : tx.vin) {
466465
CAmount v = 0;
467466
if (!CheckCanLock(in.prevout, printDebug, tx.GetHash(), &v, params)) {
468467
return false;
469468
}
470-
471-
nValueIn += v;
472469
}
473470

474471
return true;
@@ -560,8 +557,6 @@ void CInstantSendManager::HandleNewRecoveredSig(const CRecoveredSig& recoveredSi
560557

561558
void CInstantSendManager::HandleNewInputLockRecoveredSig(const CRecoveredSig& recoveredSig, const uint256& txid)
562559
{
563-
auto llmqType = Params().GetConsensus().llmqTypeInstantSend;
564-
565560
CTransactionRef tx;
566561
uint256 hashBlock;
567562
if (!GetTransaction(txid, tx, Params().GetConsensus(), hashBlock, true)) {
@@ -958,8 +953,6 @@ void CInstantSendManager::ProcessNewTransaction(const CTransactionRef& tx, const
958953
return;
959954
}
960955

961-
bool inMempool = mempool.get(tx->GetHash()) != nullptr;
962-
963956
uint256 islockHash;
964957
{
965958
LOCK(cs);

0 commit comments

Comments
 (0)