Mercurial > hg > bitcoin
changeset 565:cacbba45af52 draft
add parameter from to listtransactions this allows querying for ranges, i.e. transactions [from, from+count)
author | Carlo Alberto Ferraris <github@cafxx.strayorange.com> |
---|---|
date | Fri, 15 Apr 2011 08:24:59 +0200 |
parents | 9cb4838fd262 |
children | e6247fedee52 |
files | rpc.cpp |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/rpc.cpp +++ b/rpc.cpp @@ -1084,8 +1084,8 @@ { if (fHelp || params.size() > 2) throw runtime_error( - "listtransactions [account] [count=10]\n" - "Returns up to [count] most recent transactions for account <account>."); + "listtransactions [account] [count=10] [from=0]\n" + "Returns up to [count] most recent transactions skipping the first [from] transactions for account [account]."); string strAccount = "*"; if (params.size() > 0) @@ -1093,6 +1093,9 @@ int nCount = 10; if (params.size() > 1) nCount = params[1].get_int(); + int nFrom = 0; + if (params.size() > 2) + nFrom = params[2].get_int(); Array ret; CWalletDB walletdb; @@ -1117,7 +1120,7 @@ } // Now: iterate backwards until we have nCount items to return: - for (TxItems::reverse_iterator it = txByTime.rbegin(); it != txByTime.rend(); ++it) + for (TxItems::reverse_iterator it = txByTime.rbegin(), std::advance(it, nFrom); it != txByTime.rend(); ++it) { CWalletTx *const pwtx = (*it).second.first; if (pwtx != 0)