aboutsummaryrefslogtreecommitdiff
path: root/rpc.cpp
diff options
context:
space:
mode:
authorCarlo Alberto Ferraris <github@cafxx.strayorange.com>2011-04-15 08:24:59 +0200
committerCarlo Alberto Ferraris <github@cafxx.strayorange.com>2011-04-15 08:56:54 +0200
commit5aef2c0d55f2bb0de071642a944c97022d11231c (patch)
treee6ef9f64bc48000bb5bed89456b9f21d5d7fe1f4 /rpc.cpp
parentb37f09aa2e80b17028ad7fe1e87362c0f07c7406 (diff)
add parameter from to listtransactions this allows querying for ranges, i.e. transactions [from, from+count)
Diffstat (limited to 'rpc.cpp')
-rw-r--r--rpc.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/rpc.cpp b/rpc.cpp
index 93df5c22a4..69db71a80f 100644
--- a/rpc.cpp
+++ b/rpc.cpp
@@ -1084,8 +1084,8 @@ Value listtransactions(const Array& params, bool fHelp)
{
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 @@ Value listtransactions(const Array& params, bool fHelp)
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 @@ Value listtransactions(const Array& params, bool fHelp)
}
// 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)