Merge branch 'dev' into danger

This commit is contained in:
Duke
2023-10-13 09:27:38 -04:00
41 changed files with 731 additions and 192 deletions

View File

@@ -324,7 +324,6 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
result.push_back(Pair("blocktype", "mined"));
UniValue valuePools(UniValue::VARR);
valuePools.push_back(ValuePoolDesc("sprout", blockindex->nChainSproutValue, blockindex->nSproutValue));
valuePools.push_back(ValuePoolDesc("sapling", blockindex->nChainSaplingValue, blockindex->nSaplingValue));
result.push_back(Pair("valuePools", valuePools));
@@ -1310,14 +1309,10 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp, const CPubKey& my
obj.push_back(Pair("chainwork", chainActive.LastTip()->chainPower.chainWork.GetHex()));
obj.push_back(Pair("pruned", fPruneMode));
//SproutMerkleTree tree;
//pcoinsTip->GetSproutAnchorAt(pcoinsTip->GetBestAnchor(SPROUT), tree);
//obj.push_back(Pair("commitments", static_cast<uint64_t>(tree.size())));
obj.push_back(Pair("commitments", 0));
CBlockIndex* tip = chainActive.LastTip();
UniValue valuePools(UniValue::VARR);
valuePools.push_back(ValuePoolDesc("sprout", tip->nChainSproutValue, boost::none));
valuePools.push_back(ValuePoolDesc("sapling", tip->nChainSaplingValue, boost::none));
obj.push_back(Pair("valuePools", valuePools));

View File

@@ -65,7 +65,7 @@ int32_t hush_whoami(char *pubkeystr,int32_t height,uint32_t timestamp);
extern int32_t HUSH_LASTMINED,HUSH_LONGESTCHAIN,IS_HUSH_NOTARY,HUSH_INSYNC;
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
uint32_t hush_segid32(char *coinaddr);
int64_t hush_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height);
int64_t hush_coinsupply(int64_t *zfundsp,int32_t height);
int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *hushnotarized_heightp);
uint64_t hush_notarypayamount(int32_t nHeight, int64_t notarycount);
int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
@@ -416,7 +416,7 @@ public:
UniValue coinsupply(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
int32_t height = 0; int32_t currentHeight; int64_t blocks_per_year,zf1,zf3,zf12,sf1,sf3,sf12,sproutfunds,zfunds,supply1,supply3,supply12,supply = 0; UniValue result(UniValue::VOBJ);
int32_t height = 0; int32_t currentHeight; int64_t blocks_per_year,zf1,zf3,zf12,zfunds,supply1,supply3,supply12,supply = 0; UniValue result(UniValue::VOBJ);
if (fHelp || params.size() > 1)
throw runtime_error("coinsupply <height>\n"
"\nReturn coin supply information at a given block height. If no height is given, the current height is used.\n"
@@ -429,7 +429,6 @@ UniValue coinsupply(const UniValue& params, bool fHelp, const CPubKey& mypk)
" \"height\" : 420, (integer) The height of this coin supply data\n"
" \"supply\" : \"555.0\", (float) The transparent coin supply\n"
" \"zfunds\" : \"0.55555\", (float) The shielded coin supply (in zaddrs)\n"
" \"sprout\" : \"0.000\", (float) The sprout coin supply (in zcaddrs)\n"
" \"total\" : \"555.55555\", (float) The total coin supply, i.e. sum of supply + zfunds\n"
"}\n"
"\nExamples:\n"
@@ -442,23 +441,22 @@ UniValue coinsupply(const UniValue& params, bool fHelp, const CPubKey& mypk)
currentHeight = chainActive.Height();
if (height >= 0 && height <= currentHeight) {
if ( (supply= hush_coinsupply(&zfunds,&sproutfunds,height)) > 0 )
if ( (supply= hush_coinsupply(&zfunds,height)) > 0 )
{
result.push_back(Pair("result", "success"));
result.push_back(Pair("coin", SMART_CHAIN_SYMBOL[0] == 0 ? "HUSH" : SMART_CHAIN_SYMBOL));
result.push_back(Pair("height", (int)height));
result.push_back(Pair("supply", ValueFromAmount(supply)));
result.push_back(Pair("zfunds", ValueFromAmount(zfunds)));
result.push_back(Pair("sprout", ValueFromAmount(sproutfunds)));
result.push_back(Pair("total", ValueFromAmount(zfunds + supply)));
if ( ASSETCHAINS_BLOCKTIME > 0 )
{
blocks_per_year = 24*3600*365 / ASSETCHAINS_BLOCKTIME;
if ( height > blocks_per_year )
{
supply1 = hush_coinsupply(&zf1,&sf1,height - blocks_per_year/12);
supply3 = hush_coinsupply(&zf3,&sf3,height - blocks_per_year/4);
supply12 = hush_coinsupply(&zf12,&sf12,height - blocks_per_year);
supply1 = hush_coinsupply(&zf1,height - blocks_per_year/12);
supply3 = hush_coinsupply(&zf3,height - blocks_per_year/4);
supply12 = hush_coinsupply(&zf12,height - blocks_per_year);
if ( supply1 != 0 && supply3 != 0 && supply12 != 0 )
{
result.push_back(Pair("lastmonth", ValueFromAmount(supply1+zf1)));

View File

@@ -832,7 +832,8 @@ UniValue CRPCTable::execute(const std::string &strMethod, const UniValue &params
pcmd->name != "getnotarysendmany" && pcmd->name != "geterablockheights" &&
pcmd->name != "getaddressesbyaccount" && pcmd->name != "listaddresses" && pcmd->name != "z_exportwallet" &&
pcmd->name != "notaries" && pcmd->name != "signmessage" && pcmd->name != "decoderawtransaction" &&
pcmd->name != "dumpprivkey" && pcmd->name != "getpeerinfo" && pcmd->name != "getnetworkinfo" ) {
pcmd->name != "dumpprivkey" && pcmd->name != "getpeerinfo" && pcmd->name != "getnetworkinfo" &&
pcmd->name != "abortrescan") {
throw JSONRPCError(RPC_IN_WARMUP, rpcWarmupStatus);
}
}