@@ -58,13 +58,17 @@ bool HaveKey(const SigningProvider& wallet, const CKey& key)
5858 return wallet.HaveKey (key.GetPubKey ().GetID ()) || wallet.HaveKey (key2.GetPubKey ().GetID ());
5959}
6060
61- static void WalletTxToJSON (interfaces::Chain& chain, const CWalletTx& wtx, UniValue& entry)
61+ static void WalletTxToJSON (const CWallet& wallet, const CWalletTx& wtx, UniValue& entry)
62+ EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
6263{
64+ AssertLockHeld (wallet.cs_wallet );
65+
66+ interfaces::Chain& chain = wallet.chain ();
6367 int confirms = wtx.GetDepthInMainChain ();
6468 bool fLocked = chain.isInstantSendLockedTx (wtx.GetHash ());
6569 bool chainlock = false ;
6670 if (confirms > 0 ) {
67- chainlock = wtx. IsChainLocked ( );
71+ chainlock = wallet. IsTxChainLocked (wtx );
6872 }
6973 entry.pushKV (" confirmations" , confirms);
7074 entry.pushKV (" instantlock" , fLocked || chainlock);
@@ -586,7 +590,7 @@ static CAmount GetReceived(const CWallet& wallet, const UniValue& params, bool b
586590 || !wallet.chain ().checkFinalTx (*wtx.tx )) {
587591 continue ;
588592 }
589- if (depth < min_depth && !(fAddLocked && wtx. IsLockedByInstantSend ( ))) continue ;
593+ if (depth < min_depth && !(fAddLocked && wallet. IsTxLockedByInstantSend (wtx ))) continue ;
590594
591595 for (const CTxOut& txout : wtx.tx ->vout ) {
592596 CTxDestination address;
@@ -993,7 +997,7 @@ static UniValue ListReceived(const CWallet& wallet, const UniValue& params, cons
993997 const CWalletTx& wtx = pairWtx.second ;
994998
995999 int nDepth = wtx.GetDepthInMainChain ();
996- if ((nDepth < nMinDepth) && !(fAddLocked && wtx. IsLockedByInstantSend ( )))
1000+ if ((nDepth < nMinDepth) && !(fAddLocked && wallet. IsTxLockedByInstantSend (wtx )))
9971001 continue ;
9981002
9991003 // Coinbase with less than 1 confirmation is no longer in the main chain
@@ -1245,14 +1249,14 @@ static void ListTransactions(const CWallet& wallet, const CWalletTx& wtx, int nM
12451249 entry.pushKV (" vout" , s.vout );
12461250 entry.pushKV (" fee" , ValueFromAmount (-nFee));
12471251 if (fLong )
1248- WalletTxToJSON (wallet. chain () , wtx, entry);
1252+ WalletTxToJSON (wallet, wtx, entry);
12491253 entry.pushKV (" abandoned" , wtx.isAbandoned ());
12501254 ret.push_back (entry);
12511255 }
12521256 }
12531257
12541258 // Received
1255- if (listReceived.size () > 0 && ((wtx.GetDepthInMainChain () >= nMinDepth) || wtx. IsLockedByInstantSend ( )))
1259+ if (listReceived.size () > 0 && ((wtx.GetDepthInMainChain () >= nMinDepth) || wallet. IsTxLockedByInstantSend (wtx )))
12561260 {
12571261 for (const COutputEntry& r : listReceived)
12581262 {
@@ -1292,7 +1296,7 @@ static void ListTransactions(const CWallet& wallet, const CWalletTx& wtx, int nM
12921296 }
12931297 entry.pushKV (" vout" , r.vout );
12941298 if (fLong )
1295- WalletTxToJSON (wallet. chain () , wtx, entry);
1299+ WalletTxToJSON (wallet, wtx, entry);
12961300 ret.push_back (entry);
12971301 }
12981302 }
@@ -1664,7 +1668,7 @@ static RPCHelpMan gettransaction()
16641668 if (wtx.IsFromMe (filter))
16651669 entry.pushKV (" fee" , ValueFromAmount (nFee));
16661670
1667- WalletTxToJSON (pwallet-> chain () , wtx, entry);
1671+ WalletTxToJSON (* pwallet, wtx, entry);
16681672
16691673 UniValue details (UniValue::VARR);
16701674 ListTransactions (*pwallet, wtx, 0 , false , details, filter, nullptr /* filter_label */ );
0 commit comments