Decentralized Devtax

This commit is contained in:
Duke
2023-06-19 09:32:32 -04:00
parent fc69220e78
commit 9f92bdd7dc
6 changed files with 65 additions and 0 deletions

View File

@@ -280,3 +280,53 @@ uint64_t hush_current_supply(uint32_t nHeight)
//fprintf(stderr,"cur_money %.8f\n",(double)cur_money/COIN);
return(cur_money);
}
//TODO: production scriptpubs
std::string DEVTAX_SCRIPTPUBS[20] = {
"76a914f70a2e3df98d2befba431dfe01d4eaa3e418f68488ac",
"76a914941907aa5f85952bc8deff20f1e50aa676a2d8dd88ac",
"76a914f70a2e3df98d2befba431dfe01d4eaa3e418f68488ac",
"76a914941907aa5f85952bc8deff20f1e50aa676a2d8dd88ac",
"76a914f70a2e3df98d2befba431dfe01d4eaa3e418f68488ac",
"76a914941907aa5f85952bc8deff20f1e50aa676a2d8dd88ac",
"76a914f70a2e3df98d2befba431dfe01d4eaa3e418f68488ac",
"76a914941907aa5f85952bc8deff20f1e50aa676a2d8dd88ac",
"76a914f70a2e3df98d2befba431dfe01d4eaa3e418f68488ac",
"76a914941907aa5f85952bc8deff20f1e50aa676a2d8dd88ac",
"76a914f70a2e3df98d2befba431dfe01d4eaa3e418f68488ac",
"76a914941907aa5f85952bc8deff20f1e50aa676a2d8dd88ac",
"76a914f70a2e3df98d2befba431dfe01d4eaa3e418f68488ac",
"76a914941907aa5f85952bc8deff20f1e50aa676a2d8dd88ac",
"76a914f70a2e3df98d2befba431dfe01d4eaa3e418f68488ac",
"76a914941907aa5f85952bc8deff20f1e50aa676a2d8dd88ac",
"76a914f70a2e3df98d2befba431dfe01d4eaa3e418f68488ac",
"76a914941907aa5f85952bc8deff20f1e50aa676a2d8dd88ac",
"76a914f70a2e3df98d2befba431dfe01d4eaa3e418f68488ac",
"76a914941907aa5f85952bc8deff20f1e50aa676a2d8dd88ac"
};
// this is a deterministic consensus-changing function. All miners must be able
// to predict the scriptpub for the next block
std::string scriptpub_for_height(uint32_t nHeight) {
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
bool istush3 = strncmp(SMART_CHAIN_SYMBOL, "TUSH3",5) == 0 ? true : false;
// Fork height for HUSH3 mainnet needs to be decided just before code is merged
// Since it requires all full nodes on the network to have enough time to update.
// For testing, we choose an early blockheight so we can observe the value changing
// from the old fixed value to the new values which cycle
const int DEVTAX_FORK_HEIGHT = ishush3 ? nHushHardforkHeight4 : 5;
// Decentralized devtax is height-activated
if (nHeight >= DEVTAX_FORK_HEIGHT) {
if (ishush3 || istush3) {
// devtax_scriptpubs is an array of length 20 with 20 different scriptpubs
int NUM_SCRIPTPUBS = 20;
return DEVTAX_SCRIPTPUBS[ nHeight % NUM_SCRIPTPUBS ];
} else {
// if this is not HUSH3 or a testchain for HUSH3, return it unchanged
return ASSETCHAINS_SCRIPTPUB;
}
}
// return default unchanged if we are less than fork height
return ASSETCHAINS_SCRIPTPUB;
}