mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
wallet: Add CL/IS caches in CMerkleTx
This commit is contained in:
parent
12c840f8ce
commit
4dca83ba25
@ -5551,17 +5551,22 @@ int CMerkleTx::GetDepthInMainChain(const CBlockIndex* &pindexRet) const
|
||||
|
||||
bool CMerkleTx::IsLockedByInstantSend() const
|
||||
{
|
||||
return llmq::quorumInstantSendManager->IsLocked(GetHash());
|
||||
if (!fIsInstantSendLocked) {
|
||||
fIsInstantSendLocked = llmq::quorumInstantSendManager->IsLocked(GetHash());
|
||||
}
|
||||
return fIsInstantSendLocked;
|
||||
}
|
||||
|
||||
bool CMerkleTx::IsChainLocked() const
|
||||
{
|
||||
if (!fIsChainlocked) {
|
||||
AssertLockHeld(cs_main);
|
||||
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
|
||||
if (mi != mapBlockIndex.end() && mi->second != nullptr) {
|
||||
return llmq::chainLocksHandler->HasChainLock(mi->second->nHeight, hashBlock);
|
||||
fIsChainlocked = llmq::chainLocksHandler->HasChainLock(mi->second->nHeight, hashBlock);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return fIsChainlocked;
|
||||
}
|
||||
|
||||
int CMerkleTx::GetBlocksToMaturity() const
|
||||
|
@ -206,6 +206,9 @@ private:
|
||||
/** Constant used in hashBlock to indicate tx has been abandoned */
|
||||
static const uint256 ABANDON_HASH;
|
||||
|
||||
mutable bool fIsChainlocked{false};
|
||||
mutable bool fIsInstantSendLocked{false};
|
||||
|
||||
public:
|
||||
CTransactionRef tx;
|
||||
uint256 hashBlock;
|
||||
|
Loading…
Reference in New Issue
Block a user