diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 7487e4879..cf562db45 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -1,7 +1,7 @@ #include "cc/eval.h" #include "crosschain.h" #include "notarisationdb.h" -#include "notaries_staked.h" + int GetSymbolAuthority(const char* symbol) { diff --git a/src/komodo.h b/src/komodo.h index 3176f6592..3d2316961 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -16,7 +16,7 @@ #ifndef H_KOMODO_H #define H_KOMODO_H #include "komodo_defs.h" -#include "notaries_staked.h" + #ifdef _WIN32 #define printf(...) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index f820e0bd5..14555e534 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -17,7 +17,7 @@ #include "komodo_defs.h" #include "komodo_cJSON.h" -#include "notaries_staked.h" + #define KOMODO_MAINNET_START 178999 #define KOMODO_NOTARIES_HEIGHT1 814000 diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp deleted file mode 100644 index d3281127e..000000000 --- a/src/notaries_staked.cpp +++ /dev/null @@ -1,136 +0,0 @@ - -#include "notaries_staked.h" -#include "crosschain.h" -#include "cc/CCinclude.h" -#include - -extern char NOTARYADDRS[64][64]; -extern std::string NOTARY_ADDRESS,NOTARY_PUBKEY; -extern int32_t STAKED_ERA,IS_STAKED_NOTARY,IS_KOMODO_NOTARY; -extern pthread_mutex_t staked_mutex; -extern uint8_t NOTARY_PUBKEY33[33]; - -int8_t is_STAKED(const char *chain_name) -{ - static int8_t STAKED,doneinit; - if ( chain_name[0] == 0 ) - return(0); - if (doneinit == 1 && ASSETCHAINS_SYMBOL[0] != 0) - return(STAKED); - else STAKED = 0; - if ( (strcmp(chain_name, "LABS") == 0) ) - STAKED = 1; // These chains are allowed coin emissions. - else if ( (strncmp(chain_name, "LABS", 4) == 0) ) - STAKED = 2; // These chains have no coin emission, block subsidy is always 0, and comission is 0. Notary pay is allowed. - else if ( (strcmp(chain_name, "CFEK") == 0) || (strncmp(chain_name, "CFEK", 4) == 0) ) - STAKED = 3; // These chains have no speical rules at all. - else if ( (strcmp(chain_name, "TEST") == 0) || (strncmp(chain_name, "TEST", 4) == 0) ) - STAKED = 4; // These chains are for testing consensus to create a chain etc. Not meant to be actually used for anything important. - else if ( (strcmp(chain_name, "THIS_CHAIN_IS_BANNED") == 0) ) - STAKED = 255; // Any chain added to this group is banned, no notarisations are valid, as a consensus rule. Can be used to remove a chain from cluster if needed. - doneinit = 1; - return(STAKED); -}; - -int32_t STAKED_era(int timestamp) -{ - int8_t era = 0; - if (timestamp <= STAKED_NOTARIES_TIMESTAMP[0]) - return(1); - for (int32_t i = 1; i < NUM_STAKED_ERAS; i++) - { - if (timestamp <= STAKED_NOTARIES_TIMESTAMP[i] && timestamp >= (STAKED_NOTARIES_TIMESTAMP[i-1] + STAKED_ERA_GAP)) - return(i+1); - } - // if we are in a gap, return era 0, this allows to invalidate notarizations when in GAP. - return(0); -}; - -int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { - if ( STAKED_ERA != 0 ) - { - for (int8_t i = 0; i < num_notaries_STAKED[STAKED_ERA-1]; i++) { - if ( strcmp(Raddress,NOTARYADDRS[i]) == 0 ) { - notaryname.assign(notaries_STAKED[STAKED_ERA-1][i][0]); - return(i); - } - } - } - return(-1); -} - -int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { - int i; int8_t retval = 0; - static uint8_t staked_pubkeys[NUM_STAKED_ERAS][64][33],didinit[NUM_STAKED_ERAS]; - static char ChainName[65]; - - if ( ChainName[0] == 0 ) - { - if ( ASSETCHAINS_SYMBOL[0] == 0 ) - strcpy(ChainName,"KMD"); - else - strcpy(ChainName,ASSETCHAINS_SYMBOL); - } - - if ( era == 0 ) - { - // era is zero so we need to null out the pubkeys. - memset(pubkeys,0,64 * 33); - printf("%s is a STAKED chain and is in an ERA GAP.\n",ChainName); - return(64); - } - else - { - if ( didinit[era-1] == 0 ) - { - for (i=0; i