change so only ac_pubkey can mine coinbase

This commit is contained in:
blackjok3r
2018-10-16 17:14:07 +08:00
parent b66f366d5c
commit 68032ee5a7
3 changed files with 12 additions and 10 deletions

View File

@@ -1575,7 +1575,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
} }
if ( failed == 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 ) if ( failed == 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 )
{ {
if ( height == 1 ) if ( height == 1 || ASSETCHAINS_STREAM != 0 )
{ {
script = (uint8_t *)pblock->vtx[0].vout[0].scriptPubKey.data(); script = (uint8_t *)pblock->vtx[0].vout[0].scriptPubKey.data();
if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 ) { if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 ) {

View File

@@ -1562,10 +1562,9 @@ void komodo_args(char *argv0)
ASSETCHAINS_COMMISSION = GetArg("-ac_perc",0); ASSETCHAINS_COMMISSION = GetArg("-ac_perc",0);
ASSETCHAINS_OVERRIDE_PUBKEY = GetArg("-ac_pubkey",""); ASSETCHAINS_OVERRIDE_PUBKEY = GetArg("-ac_pubkey","");
ASSETCHAINS_STREAM = GetArg("-ac_stream",0); ASSETCHAINS_STREAM = GetArg("-ac_stream",0);
if ( ASSETCHAINS_STREAM != 0 && ASSETCHAINS_COMMISSION != 0 ) { if ( ASSETCHAINS_STREAM != 0 && (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_PRIVATE != 0) {
printf("ASSETCHAINS_STREAM cannot be used with ASSETCHAINS_COMMISSION setting both to 0! \n"); printf("ASSETCHAINS_STREAM cannot be used with:\n ASSETCHAINS_COMMISSION \n ASSETCHAINS_ENDSUBSIDY\n ASSETCHAINS_REWARD\n ASSETCHAINS_HALVING\n ASSETCHAINS_DECAY\n ASSETCHAINS_PRIVATE\n");
ASSETCHAINS_STREAM = 0; exit(0);
ASSETCHAINS_COMMISSION = 0;
} }
if ( (ASSETCHAINS_STAKED= GetArg("-ac_staked",0)) > 100 ) if ( (ASSETCHAINS_STAKED= GetArg("-ac_staked",0)) > 100 )
ASSETCHAINS_STAKED = 100; ASSETCHAINS_STAKED = 100;
@@ -1597,11 +1596,11 @@ void komodo_args(char *argv0)
printf("ASSETCHAINS_COMMISSION needs an ASETCHAINS_OVERRIDE_PUBKEY and cant be more than 100000000 (100%%)\n"); printf("ASSETCHAINS_COMMISSION needs an ASETCHAINS_OVERRIDE_PUBKEY and cant be more than 100000000 (100%%)\n");
} else if ( ASSETCHAINS_STREAM != 0) { } else if ( ASSETCHAINS_STREAM != 0) {
ASSETCHAINS_STREAM = 0; ASSETCHAINS_STREAM = 0;
printf("ASSETCHAINS_STREAM needs ASSETCHAINS_OVERRIDE_PUBKEY! This parameter has been ignored! \n %s",ASSETCHAINS_OVERRIDE_PUBKEY.c_str()); printf("ASSETCHAINS_STREAM needs ASSETCHAINS_OVERRIDE_PUBKEY! This parameter has been ignored! \n");
} }
if ( ASSETCHAINS_STREAM != 0 && ASSETCHAINS_SUPPLY == 10 ) { if ( ASSETCHAINS_STREAM != 0 && ASSETCHAINS_SUPPLY == 10 ) {
ASSETCHAINS_SUPPLY = 100000; ASSETCHAINS_SUPPLY = 1000000;
printf("ASSETCHAINS_STREAM is set with no supply, setting supply at 100,000 coins. \n"); printf("ASSETCHAINS_STREAM is set with no supply, setting supply at 1,000,000 coins. \n");
} }
if ( ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_STREAM != 0 || ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_PUBLIC != 0 || ASSETCHAINS_PRIVATE != 0 ) if ( ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_STREAM != 0 || ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_PUBLIC != 0 || ASSETCHAINS_PRIVATE != 0 )
{ {

View File

@@ -439,7 +439,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount)
for (i=0; i<33; i++) for (i=0; i<33; i++)
ptr[i+1] = ASSETCHAINS_OVERRIDE_PUBKEY33[i]; ptr[i+1] = ASSETCHAINS_OVERRIDE_PUBKEY33[i];
ptr[34] = OP_CHECKSIG; ptr[34] = OP_CHECKSIG;
printf("autocreate commission vout\n"); //printf("autocreate commission vout\n");
pblock->vtx[0] = txNew; pblock->vtx[0] = txNew;
} }
pblocktemplate->vTxFees[0] = -nFees; pblocktemplate->vTxFees[0] = -nFees;
@@ -839,7 +839,10 @@ void static BitcoinMiner()
{ {
if ( ASSETCHAINS_REWARD == 0 ) if ( ASSETCHAINS_REWARD == 0 )
{ {
if ( pblock->vtx.size() == 1 && pblock->vtx[0].vout.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT ) int minvoutsize = 1;
if ( ASSETCHAINS_STREAM != 0 )
minvoutsize = 2;
if ( pblock->vtx.size() == 1 && pblock->vtx[0].vout.size() == minvoutsize && Mining_height > ASSETCHAINS_MINHEIGHT )
{ {
static uint32_t counter; static uint32_t counter;
if ( counter++ < 10 ) if ( counter++ < 10 )