fix better

This commit is contained in:
blackjok3r
2019-02-04 16:40:47 +08:00
parent bd6949b987
commit 042756499f
2 changed files with 8 additions and 7 deletions

View File

@@ -245,7 +245,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
}
pblock->nTime = GetAdjustedTime();
// Now we have the block time, we can get the active notaries.
int32_t staked_era; int8_t numSN;
int32_t staked_era = 0; int8_t numSN = 0;
uint8_t staked_pubkeys[64][33] = {0};
if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 )
{
@@ -303,7 +303,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
dPriority += (double)nValueIn * 1000; // flat multiplier... max = 1e16.
} else {
int numNotaryVins = 0; bool fToCryptoAddress = false;
if ( komodo_is_notarytx(tx) == 1 )
if ( numSN != 0 && staked_pubkeys[0][0] != 0 && komodo_is_notarytx(tx) == 1 )
fToCryptoAddress = true;
BOOST_FOREACH(const CTxIn& txin, tx.vin)
@@ -346,7 +346,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
uint8_t *script; int32_t scriptlen; uint256 hash; CTransaction tx1;
// loop over notaries array and extract index of signers.
if ( fToCryptoAddress && staked_pubkeys[0][0] != 0 && GetTransaction(txin.prevout.hash,tx1,hash,false) )
if ( fToCryptoAddress && GetTransaction(txin.prevout.hash,tx1,hash,false) )
{
for (int8_t i = 0; i < numSN; i++)
{
@@ -403,7 +403,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
porphan->dPriority = dPriority;
porphan->feeRate = feeRate;
}
else if ( fNotarisation && Notarisations != 1 && is_STAKED(ASSETCHAINS_SYMBOL) != 0)
else if ( fNotarisation && Notarisations != 1 && is_STAKED(ASSETCHAINS_SYMBOL) != 0 )
continue; // If we have added a notarisation already skip the next one. There can only be one per block.
else
vecPriority.push_back(TxPriority(dPriority, feeRate, &(mi->GetTx())));
@@ -1720,7 +1720,7 @@ void static BitcoinMiner()
} //else fprintf(stderr,"duplicate at j.%d\n",j);
} else Mining_start = 0;
} else Mining_start = 0;
if ( ASSETCHAINS_STAKED > 0 )
{
int32_t percPoS,z; bool fNegative,fOverflow;

View File

@@ -10,7 +10,8 @@ extern int32_t STAKED_ERA,IS_STAKED_NOTARY,IS_KOMODO_NOTARY;
extern pthread_mutex_t staked_mutex;
extern uint8_t NOTARY_PUBKEY33[33],NUM_NOTARIES;
int8_t is_STAKED(const char *chain_name) {
int8_t is_STAKED(const char *chain_name)
{
static int8_t STAKED,doneinit;
if ( chain_name[0] == 0 )
return(0);
@@ -22,7 +23,7 @@ int8_t is_STAKED(const char *chain_name) {
STAKED = 2;
else if ( (strcmp(chain_name, "CFEK") == 0) || (strncmp(chain_name, "CFEK", 4) == 0) )
STAKED = 3;
else if ( (strcmp(chain_name, "NOTARYTEST") == 0) )
else if ( (strcmp(chain_name, "TEST") == 0) || (strncmp(chain_name, "TEST", 4) == 0) )
STAKED = 4;
else if ( (strcmp(chain_name, "THIS_CHAIN_IS_BANNED") == 0) )
STAKED = 255; // This means that all notarisations for chains that are in 255 group are invalid.