diff --git a/src/komodo_notary.h b/src/komodo_notary.h index e02860414..88ce299f7 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -22,11 +22,6 @@ #define KOMODO_MAINNET_START 178999 -extern char NOTARYADDRS[18][64]; - -//extern const char *notaries_STAKED[][2]; -//extern const int num_notaries_STAKED; - const char *Notaries_genesis[][2] = { { "jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, @@ -206,8 +201,6 @@ const char *Notaries_elected1[][2] = }; #define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9" -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); - int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) { static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; static int32_t n0,n1; @@ -220,6 +213,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam timestamp = komodo_heightstamp(height); else if ( ASSETCHAINS_SYMBOL[0] == 0 ) timestamp = 0; + // If this chain is not a staked chain, use the normal Komodo logic to determine notaries. This allows KMD to still sync and use its proper pubkeys for dPoW. if (is_STAKED(ASSETCHAINS_SYMBOL) == 0) { @@ -232,11 +226,6 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam n0 = (int32_t)(sizeof(Notaries_elected0)/sizeof(*Notaries_elected0)); for (i=0; i STAKED_ERA || didera == 0 ) { + pthread_mutex_lock(&komodo_mutex); STAKED_ERA = era; - if ( NOTARY_PUBKEY33[0] != 0 && NOTARYADDRS[0][0] != 0 ) + if ( NOTARY_PUBKEY33[0] != 0 ) { - if ( (IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) + if ( (IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) { IS_KOMODO_NOTARY = 0; - fprintf(stderr, "INIT.%d RADD.%s ERA.%d didera.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),era,didera); + fprintf(stderr, "Staked Notary Protection Active! INIT.%d RADD.%s ERA.%d didera.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),era,didera); } didera++; } + pthread_mutex_unlock(&komodo_mutex); } return(era); }; int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { int8_t notaryID = -1; + static uint8_t staked_pubkeys1[64][33],staked_pubkeys2[64][33],didstaked1,didstaked2; + static uint8_t staked_pubkeys3[64][33],staked_pubkeys4[64][33],didstaked3,didstaked4; + static char ChainName[65]; + + if ( ChainName[0] == 0 ) { + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + strcpy(ChainName,"KMD"); + else + strcpy(ChainName,ASSETCHAINS_SYMBOL); + } + if ( STAKED_ERA != 0 ) { switch (STAKED_ERA) { case 1: + if ( didstaked1 == 0 ) { + for (i=0; i