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

@@ -1791,13 +1791,13 @@ int32_t hush_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
int32_t hush_scpublic(uint32_t tiptime)
{
// HUSH does not support public blockchains, go use something else if you want no privacy
// HUSH does not support surveillance coins, go use something else if you want no privacy
return 0;
}
int64_t hush_newcoins(int64_t *zfundsp,int64_t *sproutfundsp,int32_t nHeight,CBlock *pblock)
int64_t hush_newcoins(int64_t *zfundsp,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,sproutfunds=0;
CTxDestination address; int32_t i,j,m,n,vout; uint8_t *script; uint256 txid,hashBlock; int64_t zfunds=0,vinsum=0,voutsum=0;
n = pblock->vtx.size();
for (i=0; i<n; i++)
{
@@ -1837,19 +1837,16 @@ int64_t hush_newcoins(int64_t *zfundsp,int64_t *sproutfundsp,int32_t nHeight,CBl
zfunds -= tx.valueBalance;
}
*zfundsp = zfunds;
*sproutfundsp = sproutfunds;
if ( SMART_CHAIN_SYMBOL[0] == 0 && (voutsum-vinsum) == 100003*SATOSHIDEN ) // 15 times
return(3 * SATOSHIDEN);
//if ( voutsum-vinsum+zfunds > 100000*SATOSHIDEN || voutsum-vinsum+zfunds < 0 )
//. fprintf(stderr,"ht.%d vins %.8f, vouts %.8f -> %.8f zfunds %.8f\n",nHeight,dstr(vinsum),dstr(voutsum),dstr(voutsum)-dstr(vinsum),dstr(zfunds));
return(voutsum - vinsum);
}
int64_t hush_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height)
int64_t hush_coinsupply(int64_t *zfundsp,int32_t height)
{
CBlockIndex *pindex; CBlock block; int64_t zfunds=0,sproutfunds=0,supply = 0;
CBlockIndex *pindex; CBlock block; int64_t zfunds=0,supply = 0;
//fprintf(stderr,"coinsupply %d\n",height);
*zfundsp = *sproutfundsp = 0;
*zfundsp = 0;
if ( (pindex= hush_chainactive(height)) != 0 )
{
while ( pindex != 0 && pindex->GetHeight() > 0 )
@@ -1857,7 +1854,7 @@ int64_t hush_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height)
if ( pindex->newcoins == 0 && pindex->zfunds == 0 )
{
if ( hush_blockload(block,pindex) == 0 ) {
pindex->newcoins = hush_newcoins(&pindex->zfunds,&pindex->sproutfunds,pindex->GetHeight(),&block);
pindex->newcoins = hush_newcoins(&pindex->zfunds,pindex->GetHeight(),&block);
} else {
fprintf(stderr,"error loading block.%d\n",pindex->GetHeight());
return(0);
@@ -1865,13 +1862,11 @@ int64_t hush_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height)
}
supply += pindex->newcoins;
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));
pindex = pindex->pprev;
}
}
*zfundsp = zfunds;
*sproutfundsp = sproutfunds;
return(supply);
}