Return snapshot info as JSON

This commit is contained in:
Duke Leto
2018-07-17 18:42:30 +00:00
parent 920f960122
commit 92dc28a3c9
4 changed files with 38 additions and 29 deletions

View File

@@ -1015,7 +1015,7 @@ UniValue getaddressbalance(const UniValue& params, bool fHelp)
}
int32_t komodo_snapshot();
UniValue komodo_snapshot();
UniValue getsnapshot(const UniValue& params, bool fHelp)
{
@@ -1026,9 +1026,13 @@ UniValue getsnapshot(const UniValue& params, bool fHelp)
"getsnapshot\n"
);
}
if ( (total= komodo_snapshot()) >= 0 )
result.push_back(Pair("total", (double)total/COIN));
else result.push_back(Pair("error", "no addressindex"));
result = komodo_snapshot();
if ( result.size() > 0 ) {
// add timestamp, maybe block height?
result.push_back(Pair("time", time(NULL)));
} else {
result.push_back(Pair("error", "no addressindex"));
}
return(result);
}