@@ -329,11 +329,12 @@ static void MaybePushAddress(UniValue & entry, const CTxDestination &dest)
329
329
* @param wtx The wallet transaction.
330
330
* @param nMinDepth The minimum confirmation depth.
331
331
* @param fLong Whether to include the JSON version of the transaction.
332
- * @param ret The UniValue into which the result is stored.
332
+ * @param ret The vector into which the result is stored.
333
333
* @param filter_ismine The "is mine" filter flags.
334
334
* @param filter_label Optional label string to filter incoming transactions.
335
335
*/
336
- static void ListTransactions (const CWallet& wallet, const CWalletTx& wtx, int nMinDepth, bool fLong , UniValue& ret, const isminefilter& filter_ismine, const std::string* filter_label) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
336
+ template <class Vec >
337
+ static void ListTransactions (const CWallet& wallet, const CWalletTx& wtx, int nMinDepth, bool fLong , Vec& ret, const isminefilter& filter_ismine, const std::string* filter_label) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
337
338
{
338
339
CAmount nFee;
339
340
std::list<COutputEntry> listReceived;
@@ -519,8 +520,7 @@ RPCHelpMan listtransactions()
519
520
if (nFrom < 0 )
520
521
throw JSONRPCError (RPC_INVALID_PARAMETER, " Negative from" );
521
522
522
- UniValue ret (UniValue::VARR);
523
-
523
+ std::vector<UniValue> ret;
524
524
{
525
525
LOCK (pwallet->cs_wallet );
526
526
@@ -542,9 +542,9 @@ RPCHelpMan listtransactions()
542
542
if ((nFrom + nCount) > (int )ret.size ())
543
543
nCount = ret.size () - nFrom;
544
544
545
- const std::vector<UniValue>& txs = ret.getValues () ;
545
+ auto txs_rev_it{ std::make_move_iterator ( ret.rend ())} ;
546
546
UniValue result{UniValue::VARR};
547
- result.push_backV ({ txs. rend () - nFrom - nCount, txs. rend () - nFrom } ); // Return oldest to newest
547
+ result.push_backV (txs_rev_it - nFrom - nCount, txs_rev_it - nFrom); // Return oldest to newest
548
548
return result;
549
549
},
550
550
};
0 commit comments