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(); pblock->nTime = GetAdjustedTime();
// Now we have the block time, we can get the active notaries. // 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}; uint8_t staked_pubkeys[64][33] = {0};
if ( is_STAKED(ASSETCHAINS_SYMBOL) != 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. dPriority += (double)nValueIn * 1000; // flat multiplier... max = 1e16.
} else { } else {
int numNotaryVins = 0; bool fToCryptoAddress = false; 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; fToCryptoAddress = true;
BOOST_FOREACH(const CTxIn& txin, tx.vin) 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; uint8_t *script; int32_t scriptlen; uint256 hash; CTransaction tx1;
// loop over notaries array and extract index of signers. // 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++) for (int8_t i = 0; i < numSN; i++)
{ {
@@ -403,7 +403,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
porphan->dPriority = dPriority; porphan->dPriority = dPriority;
porphan->feeRate = feeRate; 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. continue; // If we have added a notarisation already skip the next one. There can only be one per block.
else else
vecPriority.push_back(TxPriority(dPriority, feeRate, &(mi->GetTx()))); vecPriority.push_back(TxPriority(dPriority, feeRate, &(mi->GetTx())));

View File

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