@@ -12,7 +12,7 @@ This tool converts Sprout zaddress funds into Sapling funds in a new Sapling add
|
|||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
./zmigrate zsaplingaddr
|
./zmigrate COIN zsaplingaddr
|
||||||
|
|
||||||
The above command may need to be run multiple times to complete the process.
|
The above command may need to be run multiple times to complete the process.
|
||||||
|
|
||||||
|
|||||||
@@ -940,6 +940,11 @@ again:
|
|||||||
if ( amount == lastamount3 && amount == lastamount4 )
|
if ( amount == lastamount3 && amount == lastamount4 )
|
||||||
stdamount /= 10;
|
stdamount /= 10;
|
||||||
}
|
}
|
||||||
|
if ( stdamount < COIN )
|
||||||
|
{
|
||||||
|
stdamount = COIN;
|
||||||
|
refamount = COIN * 50;
|
||||||
|
}
|
||||||
if ( stdamount < refamount )
|
if ( stdamount < refamount )
|
||||||
refamount = stdamount;
|
refamount = stdamount;
|
||||||
lastamount4 = lastamount3;
|
lastamount4 = lastamount3;
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ public:
|
|||||||
CBlockIndex* pskip;
|
CBlockIndex* pskip;
|
||||||
|
|
||||||
//! height of the entry in the chain. The genesis block has height 0
|
//! height of the entry in the chain. The genesis block has height 0
|
||||||
int64_t newcoins,zfunds; int8_t segid; // jl777 fields
|
int64_t newcoins,zfunds,sproutfunds; int8_t segid; // jl777 fields
|
||||||
//! Which # file this block is stored in (blk?????.dat)
|
//! Which # file this block is stored in (blk?????.dat)
|
||||||
int nFile;
|
int nFile;
|
||||||
|
|
||||||
|
|||||||
@@ -1851,9 +1851,9 @@ int32_t komodo_acpublic(uint32_t tiptime)
|
|||||||
return(acpublic);
|
return(acpublic);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t komodo_newcoins(int64_t *zfundsp,int32_t nHeight,CBlock *pblock)
|
int64_t komodo_newcoins(int64_t *zfundsp,int64_t *sproutfundsp,int32_t nHeight,CBlock *pblock)
|
||||||
{
|
{
|
||||||
CTxDestination address; int32_t i,j,m,n,vout; uint8_t *script; uint256 txid,hashBlock; int64_t zfunds=0,vinsum=0,voutsum=0;
|
CTxDestination address; int32_t i,j,m,n,vout; uint8_t *script; uint256 txid,hashBlock; int64_t zfunds=0,vinsum=0,voutsum=0,sproutfunds=0;
|
||||||
n = pblock->vtx.size();
|
n = pblock->vtx.size();
|
||||||
for (i=0; i<n; i++)
|
for (i=0; i<n; i++)
|
||||||
{
|
{
|
||||||
@@ -1893,10 +1893,13 @@ int64_t komodo_newcoins(int64_t *zfundsp,int32_t nHeight,CBlock *pblock)
|
|||||||
{
|
{
|
||||||
zfunds -= joinsplit.vpub_new;
|
zfunds -= joinsplit.vpub_new;
|
||||||
zfunds += joinsplit.vpub_old;
|
zfunds += joinsplit.vpub_old;
|
||||||
|
sproutfunds -= joinsplit.vpub_new;
|
||||||
|
sproutfunds += joinsplit.vpub_old;
|
||||||
}
|
}
|
||||||
zfunds -= tx.valueBalance;
|
zfunds -= tx.valueBalance;
|
||||||
}
|
}
|
||||||
*zfundsp = zfunds;
|
*zfundsp = zfunds;
|
||||||
|
*sproutfundsp = sproutfunds;
|
||||||
if ( ASSETCHAINS_SYMBOL[0] == 0 && (voutsum-vinsum) == 100003*SATOSHIDEN ) // 15 times
|
if ( ASSETCHAINS_SYMBOL[0] == 0 && (voutsum-vinsum) == 100003*SATOSHIDEN ) // 15 times
|
||||||
return(3 * SATOSHIDEN);
|
return(3 * SATOSHIDEN);
|
||||||
//if ( voutsum-vinsum+zfunds > 100000*SATOSHIDEN || voutsum-vinsum+zfunds < 0 )
|
//if ( voutsum-vinsum+zfunds > 100000*SATOSHIDEN || voutsum-vinsum+zfunds < 0 )
|
||||||
@@ -1904,11 +1907,11 @@ int64_t komodo_newcoins(int64_t *zfundsp,int32_t nHeight,CBlock *pblock)
|
|||||||
return(voutsum - vinsum);
|
return(voutsum - vinsum);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t komodo_coinsupply(int64_t *zfundsp,int32_t height)
|
int64_t komodo_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height)
|
||||||
{
|
{
|
||||||
CBlockIndex *pindex; CBlock block; int64_t zfunds=0,supply = 0;
|
CBlockIndex *pindex; CBlock block; int64_t zfunds=0,sproutfunds=0,supply = 0;
|
||||||
//fprintf(stderr,"coinsupply %d\n",height);
|
//fprintf(stderr,"coinsupply %d\n",height);
|
||||||
*zfundsp = 0;
|
*zfundsp = *sproutfundsp = 0;
|
||||||
if ( (pindex= komodo_chainactive(height)) != 0 )
|
if ( (pindex= komodo_chainactive(height)) != 0 )
|
||||||
{
|
{
|
||||||
while ( pindex != 0 && pindex->GetHeight() > 0 )
|
while ( pindex != 0 && pindex->GetHeight() > 0 )
|
||||||
@@ -1916,7 +1919,7 @@ int64_t komodo_coinsupply(int64_t *zfundsp,int32_t height)
|
|||||||
if ( pindex->newcoins == 0 && pindex->zfunds == 0 )
|
if ( pindex->newcoins == 0 && pindex->zfunds == 0 )
|
||||||
{
|
{
|
||||||
if ( komodo_blockload(block,pindex) == 0 )
|
if ( komodo_blockload(block,pindex) == 0 )
|
||||||
pindex->newcoins = komodo_newcoins(&pindex->zfunds,pindex->GetHeight(),&block);
|
pindex->newcoins = komodo_newcoins(&pindex->zfunds,&pindex->sproutfunds,pindex->GetHeight(),&block);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr,"error loading block.%d\n",pindex->GetHeight());
|
fprintf(stderr,"error loading block.%d\n",pindex->GetHeight());
|
||||||
@@ -1925,10 +1928,12 @@ int64_t komodo_coinsupply(int64_t *zfundsp,int32_t height)
|
|||||||
}
|
}
|
||||||
supply += pindex->newcoins;
|
supply += pindex->newcoins;
|
||||||
zfunds += pindex->zfunds;
|
zfunds += pindex->zfunds;
|
||||||
|
sproutfunds += pindex->sproutfunds;
|
||||||
//printf("start ht.%d new %.8f -> supply %.8f zfunds %.8f -> %.8f\n",pindex->GetHeight(),dstr(pindex->newcoins),dstr(supply),dstr(pindex->zfunds),dstr(zfunds));
|
//printf("start ht.%d new %.8f -> supply %.8f zfunds %.8f -> %.8f\n",pindex->GetHeight(),dstr(pindex->newcoins),dstr(supply),dstr(pindex->zfunds),dstr(zfunds));
|
||||||
pindex = pindex->pprev;
|
pindex = pindex->pprev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*zfundsp = zfunds;
|
*zfundsp = zfunds;
|
||||||
|
*sproutfundsp = sproutfunds;
|
||||||
return(supply);
|
return(supply);
|
||||||
}
|
}
|
||||||
|
|||||||
11
src/main.cpp
11
src/main.cpp
@@ -1076,11 +1076,14 @@ bool ContextualCheckTransaction(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rules that apply to Overwinter or later:
|
// Rules that apply to Overwinter or later:
|
||||||
if (overwinterActive) {
|
if (overwinterActive)
|
||||||
|
{
|
||||||
// Reject transactions intended for Sprout
|
// Reject transactions intended for Sprout
|
||||||
if (!tx.fOverwintered) {
|
if (!tx.fOverwintered)
|
||||||
|
{
|
||||||
int32_t ht = Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight;
|
int32_t ht = Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight;
|
||||||
return state.DoS((ht < 0 || nHeight < ht) ? 0 : dosLevel, error("ContextualCheckTransaction: overwinter is active"),REJECT_INVALID, "tx-overwinter-active");
|
fprintf(stderr,"overwinter is active tx.%s not, ht.%d vs %d\n",tx.GetHash().ToString().c_str(),nHeight,ht);
|
||||||
|
return state.DoS((ASSETCHAINS_PRIVATE != 0 || ht < 0 || nHeight < ht) ? 0 : dosLevel, error("ContextualCheckTransaction: overwinter is active"),REJECT_INVALID, "tx-overwinter-active");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that all transactions are unexpired
|
// Check that all transactions are unexpired
|
||||||
@@ -4918,7 +4921,7 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat
|
|||||||
*ppindex = pindex;
|
*ppindex = pindex;
|
||||||
if ( pindex != 0 && pindex->nStatus & BLOCK_FAILED_MASK )
|
if ( pindex != 0 && pindex->nStatus & BLOCK_FAILED_MASK )
|
||||||
{
|
{
|
||||||
if ( ASSETCHAINS_CC == 0 )
|
if ( ASSETCHAINS_CC == 0 )//&& (ASSETCHAINS_PRIVATE == 0 || KOMODO_INSYNC >= Params().GetConsensus().vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight) )
|
||||||
return state.Invalid(error("%s: block is marked invalid", __func__), 0, "duplicate");
|
return state.Invalid(error("%s: block is marked invalid", __func__), 0, "duplicate");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ extern uint64_t KOMODO_INTERESTSUM,KOMODO_WALLETBALANCE;
|
|||||||
extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,KOMODO_LONGESTCHAIN;
|
extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,KOMODO_LONGESTCHAIN;
|
||||||
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,int32_t height);
|
int64_t komodo_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height);
|
||||||
int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp);
|
int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp);
|
||||||
#define KOMODO_VERSION "0.3.1"
|
#define KOMODO_VERSION "0.3.1"
|
||||||
#define VERUS_VERSION "0.4.0g"
|
#define VERUS_VERSION "0.4.0g"
|
||||||
@@ -282,7 +282,7 @@ public:
|
|||||||
|
|
||||||
UniValue coinsupply(const UniValue& params, bool fHelp)
|
UniValue coinsupply(const UniValue& params, bool fHelp)
|
||||||
{
|
{
|
||||||
int32_t height = 0; int32_t currentHeight; int64_t zfunds,supply = 0; UniValue result(UniValue::VOBJ);
|
int32_t height = 0; int32_t currentHeight; int64_t sproutfunds,zfunds,supply = 0; UniValue result(UniValue::VOBJ);
|
||||||
if (fHelp || params.size() > 1)
|
if (fHelp || params.size() > 1)
|
||||||
throw runtime_error("coinsupply <height>\n"
|
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"
|
"\nReturn coin supply information at a given block height. If no height is given, the current height is used.\n"
|
||||||
@@ -295,7 +295,8 @@ UniValue coinsupply(const UniValue& params, bool fHelp)
|
|||||||
" \"height\" : 420, (integer) The height of this coin supply data\n"
|
" \"height\" : 420, (integer) The height of this coin supply data\n"
|
||||||
" \"supply\" : \"777.0\", (float) The transparent coin supply\n"
|
" \"supply\" : \"777.0\", (float) The transparent coin supply\n"
|
||||||
" \"zfunds\" : \"0.777\", (float) The shielded coin supply (in zaddrs)\n"
|
" \"zfunds\" : \"0.777\", (float) The shielded coin supply (in zaddrs)\n"
|
||||||
" \"total\" : \"777.777\", (float) The total coin supply, i.e. sum of supply + zfunds\n"
|
" \"sprout\" : \"0.077\", (float) The sprout coin supply (in zcaddrs)\n"
|
||||||
|
" \"total\" : \"777.777\", (float) The total coin supply, i.e. sum of supply + zfunds\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
"\nExamples:\n"
|
||||||
+ HelpExampleCli("coinsupply", "420")
|
+ HelpExampleCli("coinsupply", "420")
|
||||||
@@ -307,13 +308,14 @@ UniValue coinsupply(const UniValue& params, bool fHelp)
|
|||||||
currentHeight = chainActive.Height();
|
currentHeight = chainActive.Height();
|
||||||
|
|
||||||
if (height >= 0 && height <= currentHeight) {
|
if (height >= 0 && height <= currentHeight) {
|
||||||
if ( (supply= komodo_coinsupply(&zfunds,height)) > 0 )
|
if ( (supply= komodo_coinsupply(&zfunds,&sproutfunds,height)) > 0 )
|
||||||
{
|
{
|
||||||
result.push_back(Pair("result", "success"));
|
result.push_back(Pair("result", "success"));
|
||||||
result.push_back(Pair("coin", ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL));
|
result.push_back(Pair("coin", ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL));
|
||||||
result.push_back(Pair("height", (int)height));
|
result.push_back(Pair("height", (int)height));
|
||||||
result.push_back(Pair("supply", ValueFromAmount(supply)));
|
result.push_back(Pair("supply", ValueFromAmount(supply)));
|
||||||
result.push_back(Pair("zfunds", ValueFromAmount(zfunds)));
|
result.push_back(Pair("zfunds", ValueFromAmount(zfunds)));
|
||||||
|
result.push_back(Pair("sprout", ValueFromAmount(sproutfunds)));
|
||||||
result.push_back(Pair("total", ValueFromAmount(zfunds + supply)));
|
result.push_back(Pair("total", ValueFromAmount(zfunds + supply)));
|
||||||
} else result.push_back(Pair("error", "couldnt calculate supply"));
|
} else result.push_back(Pair("error", "couldnt calculate supply"));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user