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
|
bool CMerkleTx::IsLockedByInstantSend() const
|
||||||
{
|
{
|
||||||
return llmq::quorumInstantSendManager->IsLocked(GetHash());
|
if (!fIsInstantSendLocked) {
|
||||||
|
fIsInstantSendLocked = llmq::quorumInstantSendManager->IsLocked(GetHash());
|
||||||
|
}
|
||||||
|
return fIsInstantSendLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMerkleTx::IsChainLocked() const
|
bool CMerkleTx::IsChainLocked() const
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs_main);
|
if (!fIsChainlocked) {
|
||||||
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
|
AssertLockHeld(cs_main);
|
||||||
if (mi != mapBlockIndex.end() && mi->second != nullptr) {
|
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
|
||||||
return llmq::chainLocksHandler->HasChainLock(mi->second->nHeight, hashBlock);
|
if (mi != mapBlockIndex.end() && mi->second != nullptr) {
|
||||||
|
fIsChainlocked = llmq::chainLocksHandler->HasChainLock(mi->second->nHeight, hashBlock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return fIsChainlocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CMerkleTx::GetBlocksToMaturity() const
|
int CMerkleTx::GetBlocksToMaturity() const
|
||||||
|
@ -206,6 +206,9 @@ private:
|
|||||||
/** Constant used in hashBlock to indicate tx has been abandoned */
|
/** Constant used in hashBlock to indicate tx has been abandoned */
|
||||||
static const uint256 ABANDON_HASH;
|
static const uint256 ABANDON_HASH;
|
||||||
|
|
||||||
|
mutable bool fIsChainlocked{false};
|
||||||
|
mutable bool fIsInstantSendLocked{false};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CTransactionRef tx;
|
CTransactionRef tx;
|
||||||
uint256 hashBlock;
|
uint256 hashBlock;
|
||||||
|
Loading…
Reference in New Issue
Block a user