Skip to content

Commit

Permalink
Whenever we check for locked TXs, also check for the new system havin…
Browse files Browse the repository at this point in the history
…g a lock
  • Loading branch information
codablock committed Mar 7, 2019
1 parent 3a6cc2c commit 1d2d370
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/governance-object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "util.h"
#include "validation.h"

#include "llmq/quorums_instantsend.h"

#include <string>
#include <univalue.h>

Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "evo/cbtx.h"

#include "llmq/quorums_chainlocks.h"
#include "llmq/quorums_instantsend.h"

#include <stdint.h>

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion src/rpc/rawtransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

#include "llmq/quorums_chainlocks.h"
#include "llmq/quorums_commitment.h"
#include "llmq/quorums_instantsend.h"

#include <stdint.h>

Expand Down Expand Up @@ -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));
}

Expand Down
4 changes: 3 additions & 1 deletion src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 3 additions & 1 deletion src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "privatesend-client.h"

#include "llmq/quorums_chainlocks.h"
#include "llmq/quorums_instantsend.h"

#include <stdint.h>

Expand Down Expand Up @@ -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));
Expand Down
4 changes: 3 additions & 1 deletion src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

#include "evo/providertx.h"

#include "llmq/quorums_instantsend.h"

#include <assert.h>

#include <boost/algorithm/string/replace.hpp>
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1d2d370

Please sign in to comment.