try periodic founders payment first time
This commit is contained in:
@@ -1112,6 +1112,7 @@ int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_
|
|||||||
commission must be in coinbase.vout[1] and must be >= 10000 sats
|
commission must be in coinbase.vout[1] and must be >= 10000 sats
|
||||||
PoS stake must be without txfee and in the last tx in the block at vout[0]
|
PoS stake must be without txfee and in the last tx in the block at vout[0]
|
||||||
*/
|
*/
|
||||||
|
int32_t ASSETCHAINS_FOUNDERS_PERIOD = 5;
|
||||||
|
|
||||||
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
|
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
|
||||||
|
|
||||||
@@ -1123,11 +1124,14 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height)
|
|||||||
{
|
{
|
||||||
nSubsidy = GetBlockSubsidy(height,Params().GetConsensus());
|
nSubsidy = GetBlockSubsidy(height,Params().GetConsensus());
|
||||||
//fprintf(stderr,"ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION));
|
//fprintf(stderr,"ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION));
|
||||||
return((nSubsidy * ASSETCHAINS_COMMISSION) / COIN);
|
comission = ((nSubsidy * ASSETCHAINS_COMMISSION) / COIN)
|
||||||
n = pblock->vtx[0].vout.size();
|
if ( ASSETCHAINS_FOUNDERS_PERIOD != 0 )
|
||||||
for (j=0; j<n; j++)
|
{
|
||||||
if ( j != 1 )
|
if ( pblock->nHeight % ASSETCHAINS_FOUNDERS_PERIOD == 0 )
|
||||||
total += pblock->vtx[0].vout[j].nValue;
|
comission = comission * ASSETCHAINS_FOUNDERS_PERIOD;
|
||||||
|
else
|
||||||
|
comission = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1141,7 +1145,10 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height)
|
|||||||
total += pblock->vtx[i].vout[j].nValue;
|
total += pblock->vtx[i].vout[j].nValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
commission = ((total * ASSETCHAINS_COMMISSION) / COIN);
|
||||||
}
|
}
|
||||||
|
if ( commission < 10000 )
|
||||||
|
commission = 0;
|
||||||
return(commission);
|
return(commission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1665,9 +1672,7 @@ int64_t komodo_checkcommission(CBlock *pblock,int32_t height)
|
|||||||
{
|
{
|
||||||
checktoshis = komodo_commission(pblock,height);
|
checktoshis = komodo_commission(pblock,height);
|
||||||
//fprintf(stderr,"height.%d commission %.8f\n",height,(double)checktoshis/COIN);
|
//fprintf(stderr,"height.%d commission %.8f\n",height,(double)checktoshis/COIN);
|
||||||
/*if ( checktoshis > 10000 && pblock->vtx[0].vout.size() != 2 ) jl777: not sure why this was here
|
if ( checktoshis != 0 )
|
||||||
return(-1);
|
|
||||||
else*/ if ( checktoshis != 0 )
|
|
||||||
{
|
{
|
||||||
script = (uint8_t *)&pblock->vtx[0].vout[1].scriptPubKey[0];
|
script = (uint8_t *)&pblock->vtx[0].vout[1].scriptPubKey[0];
|
||||||
scriptlen = (int32_t)pblock->vtx[0].vout[1].scriptPubKey.size();
|
scriptlen = (int32_t)pblock->vtx[0].vout[1].scriptPubKey.size();
|
||||||
|
|||||||
Reference in New Issue
Block a user