Latest Komodo changes

This commit is contained in:
miketout
2018-11-17 17:28:45 -08:00
16 changed files with 274 additions and 196 deletions

View File

@@ -1108,7 +1108,7 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height)
if ( ASSETCHAINS_FOUNDERS != 0 )
{
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);
n = pblock->vtx[0].vout.size();
for (j=0; j<n; j++)
@@ -1654,7 +1654,7 @@ int64_t komodo_checkcommission(CBlock *pblock,int32_t height)
if ( ASSETCHAINS_COMMISSION != 0 )
{
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
return(-1);
else*/ if ( checktoshis != 0 )
@@ -1676,10 +1676,10 @@ int64_t komodo_checkcommission(CBlock *pblock,int32_t height)
matched = 25;
if ( matched == 0 )
{
int32_t i;
for (i=0; i<25; i++)
fprintf(stderr,"%02x",script[i]);
fprintf(stderr," payment to wrong pubkey scriptlen.%d, scriptpub[%d]\n",scriptlen,(int32_t)ASSETCHAINS_SCRIPTPUB.size()/2);
//int32_t i;
//for (i=0; i<25; i++)
// fprintf(stderr,"%02x",script[i]);
//fprintf(stderr," payment to wrong pubkey scriptlen.%d, scriptpub[%d]\n",scriptlen,(int32_t)ASSETCHAINS_SCRIPTPUB.size()/2);
return(-1);
}
@@ -1783,13 +1783,26 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
return(-1);
}
}
if ( failed == 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 )
if ( failed == 0 && ASSETCHAINS_COMMISSION != 0 ) //ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 )
{
if ( height == 1 )
{
script = (uint8_t *)&pblock->vtx[0].vout[0].scriptPubKey[0];
if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 )
return(-1);
if ( ASSETCHAINS_SCRIPTPUB.size() > 1 )
{
int32_t scriptlen; uint8_t scripthex[10000];
if ( ASSETCHAINS_SCRIPTPUB.size()/2 == pblock->vtx[0].vout[0].scriptPubKey.size() && scriptlen < sizeof(scripthex) )
{
decode_hex(scripthex,scriptlen,(char *)ASSETCHAINS_SCRIPTPUB.c_str());
if ( memcmp(scripthex,script,scriptlen) != 0 )
return(-1);
} else return(-1);
}
else
{
script = (uint8_t *)&pblock->vtx[0].vout[0].scriptPubKey[0];
if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 )
return(-1);
}
}
else
{