Add synced key to getinfo+getblockchaininfo

This addresses #3 of upstream issue
https://github.com/zcash/zcash/issues/3996 .

Any software that creates a transaction outside of the RPC interface
MUST check if synced==true beforehand, otherwise metadata leakage which
leads to linkability analysis is possible.

The z_sendmany, z_shieldcoinbase and z_mergetoaddress RPCs have their
own synced checks, so it's not needed to look at this new synced value
when using those RPCs.
This commit is contained in:
Jonathan "Duke" Leto
2019-05-15 22:07:09 -07:00
parent 8b57ca63b8
commit 3275b435de
2 changed files with 5 additions and 2 deletions

View File

@@ -48,6 +48,7 @@
using namespace std;
extern int32_t KOMODO_INSYNC;
extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry);
void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex);
#include "komodo_defs.h"
@@ -1689,6 +1690,7 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("chain", Params().NetworkIDString()));
obj.push_back(Pair("blocks", (int)chainActive.Height()));
obj.push_back(Pair("synced", KOMODO_INSYNC!=0));
obj.push_back(Pair("headers", pindexBestHeader ? pindexBestHeader->GetHeight() : -1));
obj.push_back(Pair("bestblockhash", chainActive.LastTip()->GetBlockHash().GetHex()));
obj.push_back(Pair("difficulty", (double)GetNetworkDifficulty()));
@@ -2082,4 +2084,4 @@ void RegisterBlockchainRPCCommands(CRPCTable &tableRPC)
{
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
tableRPC.appendCommand(commands[vcidx].name, &commands[vcidx]);
}
}