Whenever we check for locked TXs, also check for the new system having a lock

This commit is contained in:
Alexander Block 2019-02-28 13:59:57 +01:00
parent 3a6cc2cc17
commit 1d2d370cd0
6 changed files with 17 additions and 6 deletions

View File

@ -16,6 +16,8 @@
#include "util.h"
#include "validation.h"
#include "llmq/quorums_instantsend.h"
#include <string>
#include <univalue.h>
@ -618,7 +620,7 @@ bool CGovernanceObject::IsCollateralValid(std::string& strError, bool& fMissingC
}
if ((nConfirmationsIn < GOVERNANCE_FEE_CONFIRMATIONS) &&
(!instantsend.IsLockedInstantSendTransaction(nCollateralHash))) {
(!instantsend.IsLockedInstantSendTransaction(nCollateralHash) || llmq::quorumInstantSendManager->IsLocked(nCollateralHash))) {
strError = strprintf("Collateral requires at least %d confirmations to be relayed throughout the network (it has only %d)", GOVERNANCE_FEE_CONFIRMATIONS, nConfirmationsIn);
if (nConfirmationsIn >= GOVERNANCE_MIN_RELAY_FEE_CONFIRMATIONS) {
fMissingConfirmations = true;

View File

@ -28,6 +28,7 @@
#include "evo/cbtx.h"
#include "llmq/quorums_chainlocks.h"
#include "llmq/quorums_instantsend.h"
#include <stdint.h>
@ -409,7 +410,7 @@ void entryToJSON(UniValue &info, const CTxMemPoolEntry &e)
info.push_back(Pair("depends", depends));
info.push_back(Pair("instantsend", instantsend.HasTxLockRequest(tx.GetHash())));
info.push_back(Pair("instantlock", instantsend.IsLockedInstantSendTransaction(tx.GetHash())));
info.push_back(Pair("instantlock", instantsend.IsLockedInstantSendTransaction(tx.GetHash()) || llmq::quorumInstantSendManager->IsLocked(tx.GetHash())));
}
UniValue mempoolToJSON(bool fVerbose = false)

View File

@ -36,6 +36,7 @@
#include "llmq/quorums_chainlocks.h"
#include "llmq/quorums_commitment.h"
#include "llmq/quorums_instantsend.h"
#include <stdint.h>
@ -199,7 +200,8 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
}
}
bool fLocked = instantsend.IsLockedInstantSendTransaction(txid);
entry.push_back(Pair("instantlock", fLocked));
bool fLLMQLocked = llmq::quorumInstantSendManager->IsLocked(txid);
entry.push_back(Pair("instantlock", fLocked || fLLMQLocked));
entry.push_back(Pair("chainlock", chainLock));
}

View File

@ -24,6 +24,8 @@
#include "evo/specialtx.h"
#include "evo/providertx.h"
#include "llmq/quorums_instantsend.h"
CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef& _tx, const CAmount& _nFee,
int64_t _nTime, double _entryPriority, unsigned int _entryHeight,
CAmount _inChainInputValue,
@ -1497,7 +1499,7 @@ int CTxMemPool::Expire(int64_t time) {
setEntries toremove;
while (it != mapTx.get<entry_time>().end() && it->GetTime() < time) {
// locked txes do not expire until mined and have sufficient confirmations
if (instantsend.IsLockedInstantSendTransaction(it->GetTx().GetHash())) {
if (instantsend.IsLockedInstantSendTransaction(it->GetTx().GetHash()) || llmq::quorumInstantSendManager->IsLocked(it->GetTx().GetHash())) {
it++;
continue;
}

View File

@ -23,6 +23,7 @@
#include "privatesend-client.h"
#include "llmq/quorums_chainlocks.h"
#include "llmq/quorums_instantsend.h"
#include <stdint.h>
@ -65,12 +66,13 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
AssertLockHeld(cs_main); // for mapBlockIndex
int confirms = wtx.GetDepthInMainChain();
bool fLocked = instantsend.IsLockedInstantSendTransaction(wtx.GetHash());
bool fLLMQLocked = llmq::quorumInstantSendManager->IsLocked(wtx.GetHash());
bool chainlock = false;
if (confirms > 0) {
chainlock = llmq::chainLocksHandler->HasChainLock(mapBlockIndex[wtx.hashBlock]->nHeight, wtx.hashBlock);
}
entry.push_back(Pair("confirmations", confirms));
entry.push_back(Pair("instantlock", fLocked));
entry.push_back(Pair("instantlock", fLocked || fLLMQLocked));
entry.push_back(Pair("chainlock", chainlock));
if (wtx.IsCoinBase())
entry.push_back(Pair("generated", true));

View File

@ -36,6 +36,8 @@
#include "evo/providertx.h"
#include "llmq/quorums_instantsend.h"
#include <assert.h>
#include <boost/algorithm/string/replace.hpp>
@ -5426,7 +5428,7 @@ int CMerkleTx::GetDepthInMainChain(const CBlockIndex* &pindexRet) const
bool CMerkleTx::IsLockedByInstantSend() const
{
return instantsend.IsLockedInstantSendTransaction(GetHash());
return instantsend.IsLockedInstantSendTransaction(GetHash()) || llmq::quorumInstantSendManager->IsLocked(GetHash());
}
int CMerkleTx::GetBlocksToMaturity() const