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:
@@ -48,6 +48,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
extern int32_t KOMODO_INSYNC;
|
||||||
extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry);
|
extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry);
|
||||||
void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex);
|
void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex);
|
||||||
#include "komodo_defs.h"
|
#include "komodo_defs.h"
|
||||||
@@ -1689,6 +1690,7 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
|
|||||||
UniValue obj(UniValue::VOBJ);
|
UniValue obj(UniValue::VOBJ);
|
||||||
obj.push_back(Pair("chain", Params().NetworkIDString()));
|
obj.push_back(Pair("chain", Params().NetworkIDString()));
|
||||||
obj.push_back(Pair("blocks", (int)chainActive.Height()));
|
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("headers", pindexBestHeader ? pindexBestHeader->GetHeight() : -1));
|
||||||
obj.push_back(Pair("bestblockhash", chainActive.LastTip()->GetBlockHash().GetHex()));
|
obj.push_back(Pair("bestblockhash", chainActive.LastTip()->GetBlockHash().GetHex()));
|
||||||
obj.push_back(Pair("difficulty", (double)GetNetworkDifficulty()));
|
obj.push_back(Pair("difficulty", (double)GetNetworkDifficulty()));
|
||||||
@@ -2082,4 +2084,4 @@ void RegisterBlockchainRPCCommands(CRPCTable &tableRPC)
|
|||||||
{
|
{
|
||||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
||||||
tableRPC.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
tableRPC.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ bool komodo_txnotarizedconfirmed(uint256 txid);
|
|||||||
uint32_t komodo_chainactive_timestamp();
|
uint32_t komodo_chainactive_timestamp();
|
||||||
int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp);
|
int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp);
|
||||||
extern uint64_t KOMODO_INTERESTSUM,KOMODO_WALLETBALANCE;
|
extern uint64_t KOMODO_INTERESTSUM,KOMODO_WALLETBALANCE;
|
||||||
extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,KOMODO_LONGESTCHAIN,IS_STAKED_NOTARY,IS_KOMODO_NOTARY,STAKED_ERA;
|
extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,KOMODO_LONGESTCHAIN,IS_STAKED_NOTARY,IS_KOMODO_NOTARY,STAKED_ERA,KOMODO_INSYNC;
|
||||||
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
||||||
uint32_t komodo_segid32(char *coinaddr);
|
uint32_t komodo_segid32(char *coinaddr);
|
||||||
int64_t komodo_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height);
|
int64_t komodo_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height);
|
||||||
@@ -237,6 +237,7 @@ UniValue getinfo(const UniValue& params, bool fHelp)
|
|||||||
obj.push_back(Pair("version", CLIENT_VERSION));
|
obj.push_back(Pair("version", CLIENT_VERSION));
|
||||||
obj.push_back(Pair("protocolversion", PROTOCOL_VERSION));
|
obj.push_back(Pair("protocolversion", PROTOCOL_VERSION));
|
||||||
obj.push_back(Pair("KMDversion", KOMODO_VERSION));
|
obj.push_back(Pair("KMDversion", KOMODO_VERSION));
|
||||||
|
obj.push_back(Pair("synced", KOMODO_INSYNC!=0));
|
||||||
//obj.push_back(Pair("VRSCversion", VERUS_VERSION));
|
//obj.push_back(Pair("VRSCversion", VERUS_VERSION));
|
||||||
obj.push_back(Pair("notarized", notarized_height));
|
obj.push_back(Pair("notarized", notarized_height));
|
||||||
obj.push_back(Pair("prevMoMheight", prevMoMheight));
|
obj.push_back(Pair("prevMoMheight", prevMoMheight));
|
||||||
|
|||||||
Reference in New Issue
Block a user