From 2200781907408b07f0de4988b07728680e89e7b4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 12 Jun 2018 00:26:46 -1100 Subject: [PATCH] Snapshot roc --- src/rpcmisc.cpp | 17 +++++++++++++++++ src/rpcserver.cpp | 1 + src/rpcserver.h | 3 ++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 278fb8866..b348a893f 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -993,6 +993,23 @@ UniValue getaddressbalance(const UniValue& params, bool fHelp) } +UniValue getsnapshot(const UniValue& params, bool fHelp) +{ + UniValue result(UniValue::VOBJ); int32_t num; + if ( fHelp || params.size() > 0 ) + { + throw runtime_error( + "getsnapshot\n" + ); + } + if ( pblocktree != 0 ) + { + num = pblocktree->Snapshot(); + result.push_back(Pair("numaddresses", num)); + } else result.push_back(Pair("error", "no addressindex")); + return(result); +} + UniValue getaddresstxids(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 1) diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 86a7aed86..8e9a2c634 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -345,6 +345,7 @@ static const CRPCCommand vRPCCommands[] = { "addressindex", "getaddressdeltas", &getaddressdeltas, false }, { "addressindex", "getaddresstxids", &getaddresstxids, false }, { "addressindex", "getaddressbalance", &getaddressbalance, false }, + { "addressindex", "getsnapshot", &getsnapshot, false }, /* Utility functions */ { "util", "createmultisig", &createmultisig, true }, diff --git a/src/rpcserver.h b/src/rpcserver.h index ce412cdb9..1fbcca794 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -177,7 +177,8 @@ extern UniValue getaddressmempool(const UniValue& params, bool fHelp); extern UniValue getaddressutxos(const UniValue& params, bool fHelp); extern UniValue getaddressdeltas(const UniValue& params, bool fHelp); extern UniValue getaddresstxids(const UniValue& params, bool fHelp); -extern UniValue getaddressbalance(const UniValue& params, bool fHelp); +extern UniValue getaddresstxids(const UniValue& params, bool fHelp); +extern UniValue getsnapshot(const UniValue& params, bool fHelp); extern UniValue getpeerinfo(const UniValue& params, bool fHelp); extern UniValue ping(const UniValue& params, bool fHelp); extern UniValue addnode(const UniValue& params, bool fHelp);