mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Fix "chainlock" in WalletTxToJSON (#2748)
* Fix "chainlock" in WalletTxToJSON * Add `AssertLockHeld(cs_main); // for mapBlockIndex` * move assert higher
This commit is contained in:
parent
e21d8d6b95
commit
e47af29d41
@ -62,9 +62,13 @@ void EnsureWalletIsUnlocked(CWallet * const pwallet)
|
||||
|
||||
void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
|
||||
{
|
||||
AssertLockHeld(cs_main); // for mapBlockIndex
|
||||
int confirms = wtx.GetDepthInMainChain();
|
||||
bool fLocked = instantsend.IsLockedInstantSendTransaction(wtx.GetHash());
|
||||
bool chainlock = llmq::chainLocksHandler->HasChainLock(wtx.nIndex, wtx.hashBlock);
|
||||
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("chainlock", chainlock));
|
||||
|
Loading…
Reference in New Issue
Block a user