Skip to content

Commit

Permalink
Fix "chainlock" in WalletTxToJSON (#2748)
Browse files Browse the repository at this point in the history
* Fix "chainlock" in WalletTxToJSON

* Add `AssertLockHeld(cs_main); // for mapBlockIndex`

* move assert higher
  • Loading branch information
UdjinM6 committed Mar 7, 2019
1 parent e21d8d6 commit e47af29
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit e47af29

Please sign in to comment.