@@ -1794,8 +1794,6 @@ UniValue listtransactions(const JSONRPCRequest& request)
1794
1794
// the user could have gotten from another RPC command prior to now
1795
1795
pwallet->BlockUntilSyncedToCurrentChain ();
1796
1796
1797
- LOCK2 (cs_main, pwallet->cs_wallet );
1798
-
1799
1797
std::string strAccount = " *" ;
1800
1798
if (!request.params [0 ].isNull ())
1801
1799
strAccount = request.params [0 ].get_str ();
@@ -1817,20 +1815,25 @@ UniValue listtransactions(const JSONRPCRequest& request)
1817
1815
1818
1816
UniValue ret (UniValue::VARR);
1819
1817
1820
- const CWallet::TxItems & txOrdered = pwallet->wtxOrdered ;
1821
-
1822
- // iterate backwards until we have nCount items to return:
1823
- for (CWallet::TxItems::const_reverse_iterator it = txOrdered.rbegin (); it != txOrdered.rend (); ++it)
1824
1818
{
1825
- CWalletTx *const pwtx = (*it).second .first ;
1826
- if (pwtx != nullptr )
1827
- ListTransactions (pwallet, *pwtx, strAccount, 0 , true , ret, filter);
1828
- CAccountingEntry *const pacentry = (*it).second .second ;
1829
- if (pacentry != nullptr )
1830
- AcentryToJSON (*pacentry, strAccount, ret);
1819
+ LOCK2 (cs_main, pwallet->cs_wallet );
1820
+
1821
+ const CWallet::TxItems & txOrdered = pwallet->wtxOrdered ;
1831
1822
1832
- if ((int )ret.size () >= (nCount+nFrom)) break ;
1823
+ // iterate backwards until we have nCount items to return:
1824
+ for (CWallet::TxItems::const_reverse_iterator it = txOrdered.rbegin (); it != txOrdered.rend (); ++it)
1825
+ {
1826
+ CWalletTx *const pwtx = (*it).second .first ;
1827
+ if (pwtx != nullptr )
1828
+ ListTransactions (pwallet, *pwtx, strAccount, 0 , true , ret, filter);
1829
+ CAccountingEntry *const pacentry = (*it).second .second ;
1830
+ if (pacentry != nullptr )
1831
+ AcentryToJSON (*pacentry, strAccount, ret);
1832
+
1833
+ if ((int )ret.size () >= (nCount+nFrom)) break ;
1834
+ }
1833
1835
}
1836
+
1834
1837
// ret is newest to oldest
1835
1838
1836
1839
if (nFrom > (int )ret.size ())
0 commit comments