add num notaris golbal, and reset notaries on era 0

This commit is contained in:
blackjok3r
2018-11-05 17:11:32 +08:00
parent 1c497de1fa
commit 8d687f0312
5 changed files with 43 additions and 28 deletions

View File

@@ -1044,29 +1044,39 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state,
return true;
}
}
extern char NOTARYADDRS[64][36];
extern uint8_t NUM_NOTARIES;
int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only
{
/*static int32_t didinit;
int32_t i;
if ( didinit == 0 )
{
uint8_t pubkey33[33];
for (i=0; i<=17; i++)
{
if ( i < 17 )
decode_hex(pubkey33,33,(char *)notaries_STAKED1[i][1]);
else decode_hex(pubkey33,33,(char *)CRYPTO777_PUBSECPSTR);
pubkey2addr((char *)notaryaddrs[i],(uint8_t *)pubkey33);
}
didinit = 1;
} */
if ( NOTARYADDRS[0][0] != 0 )
{
for (int32_t i=0; i<=64; i++)
if ( strcmp(coinaddr,NOTARYADDRS[i]) == 0 )
return(1);
if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 )
{
if ( NOTARYADDRS[0][0] != 0 && NUM_NOTARIES != 0 ) {
for (int32_t i=0; i<=NUM_NOTARIES; i++)
if ( strcmp(coinaddr,NOTARYADDRS[i]) == 0 )
return(1);
}
}
else
{
static int32_t didinit; static char notaryaddrs[sizeof(Notaries_elected1)/sizeof(*Notaries_elected1) + 1][64];
int32_t i;
if ( didinit == 0 )
{
uint8_t pubkey33[33];
for (i=0; i<=sizeof(Notaries_elected1)/sizeof(*Notaries_elected1); i++)
{
if ( i < sizeof(Notaries_elected1)/sizeof(*Notaries_elected1) )
decode_hex(pubkey33,33,(char *)Notaries_elected1[i][1]);
else decode_hex(pubkey33,33,(char *)CRYPTO777_PUBSECPSTR);
pubkey2addr((char *)notaryaddrs[i],(uint8_t *)pubkey33);
}
didinit = 1;
}
for (i=0; i<=sizeof(Notaries_elected1)/sizeof(*Notaries_elected1); i++)
if ( strcmp(coinaddr,notaryaddrs[i]) == 0 )
return(1);
}
return(0);
}