Merge branch 'FSM' into jl777

This commit is contained in:
jl777
2019-07-12 16:42:54 -11:00
12 changed files with 150 additions and 15 deletions

View File

@@ -268,5 +268,27 @@
"ac_supply": "64000777",
"ac_staked": "10",
"addnode": ["18.197.20.21"]
},
{
"ac_name": "HUSH3",
"ac_sapling": "1",
"ac_founders": "1",
"ac_reward": "0,1125000000,562500000",
"ac_end": "128,340000,5422111",
"ac_blocktime": "150",
"ac_supply": "6178674",
"ac_halving": "129,340000,840000",
"ac_cc": "2",
"ac_cclib": "hush3",
"ac_ccenable": "228,234,235,236,241",
"ac_perc": "11111111",
"ac_eras": "3",
"ac_script": "76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac",
"clientname": "GoldenSandtrout",
"addnode": [
"188.165.212.101",
"136.243.227.142",
"5.9.224.250"
]
}
]

View File

@@ -52,3 +52,4 @@ echo $pubkey
./komodod -pubkey=$pubkey -ac_name=KOIN -ac_supply=125000000 -addnode=3.0.32.10 &
./komodod -pubkey=$pubkey -ac_name=ZEXO -ac_supply=100000000 -ac_reward=1478310502 -ac_halving=525600 -ac_cc=42 -ac_ccenable=236 -ac_perc=77700 -ac_staked=93 -ac_pubkey=02713bd85e054db923694b6b7a85306264edf4d6bd6d331814f2b40af444b3ebbc -ac_public=1 -addnode=80.240.17.222 &
./komodod -pubkey=$pubkey -ac_name=K64 -ac_supply=64000777 -ac_reward=0 -ac_staked=10 -addnode=18.197.20.211 &
./komodod -pubkey=$pubkey -ac_name=HUSH3 -ac_sapling=1 -ac_reward=0,1125000000,562500000 -ac_halving=129,340000,840000 -ac_end=128,340000,5422111 -ac_eras=3 -ac_blocktime=150 -ac_cc=2 -ac_ccenable=228,234,235,236,241 -ac_founders=1 -ac_supply=6178674 -ac_perc=11111111 -clientname=GoldenSandtrout -addnode=188.165.212.101 -addnode=136.243.227.142 -addnode=5.9.224.250 -ac_cclib=hush3 -ac_script=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac &

7
src/fiat/hush Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
#set working directory to the location of this script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
../komodo-cli -ac_name=HUSH3 "$@"

11
src/hush-cli Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
# Copyright (c) 2019 Hush developers
# set working directory to the location of this script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
NAME=HUSH3
CLI=${KOMODOCLI:-./komodo-cli}
$CLI -ac_name=$NAME "$@"

52
src/hushd Executable file
View File

@@ -0,0 +1,52 @@
#!/bin/bash
# Copyright (c) 2019 Hush developers
# set working directory to the location of this script
DIR="$( cd "$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" && pwd )"
cd $DIR
NAME=HUSH3
# this corresponds to FR address RHushEyeDm7XwtaTWtyCbjGQumYyV8vMjn
SCRIPT=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac
# Chain parameters
ERAS=3
BLOCKTIME=150
# 6250000 - (sprout pool at block 500,000)
SUPPLY=6178674
FOUNDERS=1
REWARD=0,1125000000,562500000
PERC=11111111
HALVING=129,340000,840000
# NOTE: keep in sync with komodo_bitcoind.h
END=128,340000,5422111
CLIENTNAME=GoldenSandtrout
SEEDNODE1=188.165.212.101
SEEDNODE2=136.243.227.142
SEEDNODE3=5.9.224.250
CCLIB=hush3
# CryptoConditions/Custom Consensus params
FAUCET=228
HEIR=234
CHANNEL=235
ORACLE=236
GATEWAY=241
CCENABLE=$FAUCET,$HEIR,$CHANNEL,$ORACLE,$GATEWAY
KMD=${KOMODOD:-./komodod}
$KMD -ac_name=$NAME -ac_sapling=1 \
-ac_reward=$REWARD \
-ac_halving=$HALVING \
-ac_end=$END \
-ac_eras=$ERAS \
-ac_blocktime=$BLOCKTIME \
-ac_cc=2 -ac_ccenable=$CCENABLE \
-ac_founders=$FOUNDERS -ac_supply=$SUPPLY \
-ac_perc=$PERC \
-clientname=$CLIENTNAME \
-addnode=$SEEDNODE1 \
-addnode=$SEEDNODE2 \
-addnode=$SEEDNODE3 \
-ac_cclib=$CCLIB \
-ac_script=$SCRIPT "$@"

View File

@@ -1256,16 +1256,53 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
uint64_t komodo_commission(const CBlock *pblock,int32_t height)
{
static bool didinit = false,ishush3 = false;
// LABS fungible chains, cannot have any block reward!
if ( is_STAKED(ASSETCHAINS_SYMBOL) == 2 )
return(0);
if (!didinit) {
ishush3 = strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) == 0 ? true : false;
didinit = true;
}
int32_t i,j,n=0,txn_count; int64_t nSubsidy; uint64_t commission,total = 0;
if ( ASSETCHAINS_FOUNDERS != 0 )
{
nSubsidy = GetBlockSubsidy(height,Params().GetConsensus());
//fprintf(stderr,"ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION));
commission = ((nSubsidy * ASSETCHAINS_COMMISSION) / COIN);
if (ishush3) {
int32_t starting_commission = 125000000, HALVING1 = 340000, INTERVAL = 840000, TRANSITION = 129, BR_END = 5422111;
// HUSH supply curve cannot be exactly represented via KMD AC CLI args, so we do it ourselves.
// You specify the BR, and the FR % gets added so 10% of 12.5 is 1.25
// but to tell the AC params, I need to say "11% of 11.25" is 1.25
// 11% ie. 1/9th cannot be exactly represented and so the FR has tiny amounts of error unless done manually
// Transition period of 128 blocks has BR=FR=0
if (height < TRANSITION) {
commission = 0;
} else if (height < HALVING1) {
commission = starting_commission;
} else if (height < HALVING1+1*INTERVAL) {
commission = starting_commission / 2;
} else if (height < HALVING1+2*INTERVAL) {
commission = starting_commission / 4;
} else if (height < HALVING1+3*INTERVAL) {
commission = starting_commission / 8;
} else if (height < HALVING1+4*INTERVAL) {
commission = starting_commission / 16;
} else if (height < HALVING1+5*INTERVAL) {
commission = starting_commission / 32;
} else if (height < HALVING1+6*INTERVAL) { // Block 5380000
// Block reward will go to zero between 7th+8th halvings, ac_end may need adjusting
commission = starting_commission / 64;
} else if (height < HALVING1+7*INTERVAL) {
// Block reward will be zero before this is ever reached
commission = starting_commission / 128; // Block 6220000
}
}
if ( ASSETCHAINS_FOUNDERS > 1 )
{
if ( (height % ASSETCHAINS_FOUNDERS) == 0 )

View File

@@ -46,6 +46,7 @@ struct komodo_state KOMODO_STATES[34];
int COINBASE_MATURITY = _COINBASE_MATURITY;//100;
unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+10;
uint256 KOMODO_EARLYTXID;
int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,IS_STAKED_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1,KOMODO_DEALERNODE,KOMODO_EXTRASATOSHI,ASSETCHAINS_FOUNDERS,ASSETCHAINS_CBMATURITY,KOMODO_NSPV;
int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1;
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,ASSETCHAINS_SCRIPTPUB,NOTARY_ADDRESS,ASSETCHAINS_SELFIMPORT,ASSETCHAINS_CCLIB;

View File

@@ -1761,10 +1761,10 @@ void komodo_args(char *argv0)
ASSETCHAINS_PUBLIC = GetArg("-ac_public",0);
ASSETCHAINS_PRIVATE = GetArg("-ac_private",0);
KOMODO_SNAPSHOT_INTERVAL = GetArg("-ac_snapshot",0);
Split(GetArg("-ac_nk",""), ASSETCHAINS_NK, 0);
Split(GetArg("-ac_nk",""), sizeof(ASSETCHAINS_NK)/sizeof(*ASSETCHAINS_NK), ASSETCHAINS_NK, 0);
// -ac_ccactivateht=evalcode,height,evalcode,height,evalcode,height....
Split(GetArg("-ac_ccactivateht",""), ccEnablesHeight, 0);
Split(GetArg("-ac_ccactivateht",""), sizeof(ccEnablesHeight)/sizeof(*ccEnablesHeight), ccEnablesHeight, 0);
// fill map with all eval codes and activation height of 0.
for ( int i = 0; i < 256; i++ )
mapHeightEvalActivate[i] = 0;
@@ -1836,11 +1836,11 @@ void komodo_args(char *argv0)
ASSETCHAINS_TIMEUNLOCKFROM = ASSETCHAINS_TIMEUNLOCKTO = 0;
}
Split(GetArg("-ac_end",""), ASSETCHAINS_ENDSUBSIDY, 0);
Split(GetArg("-ac_reward",""), ASSETCHAINS_REWARD, 0);
Split(GetArg("-ac_halving",""), ASSETCHAINS_HALVING, 0);
Split(GetArg("-ac_decay",""), ASSETCHAINS_DECAY, 0);
Split(GetArg("-ac_notarypay",""), ASSETCHAINS_NOTARY_PAY, 0);
Split(GetArg("-ac_end",""), sizeof(ASSETCHAINS_ENDSUBSIDY)/sizeof(*ASSETCHAINS_ENDSUBSIDY), ASSETCHAINS_ENDSUBSIDY, 0);
Split(GetArg("-ac_reward",""), sizeof(ASSETCHAINS_REWARD)/sizeof(*ASSETCHAINS_REWARD), ASSETCHAINS_REWARD, 0);
Split(GetArg("-ac_halving",""), sizeof(ASSETCHAINS_HALVING)/sizeof(*ASSETCHAINS_HALVING), ASSETCHAINS_HALVING, 0);
Split(GetArg("-ac_decay",""), sizeof(ASSETCHAINS_DECAY)/sizeof(*ASSETCHAINS_DECAY), ASSETCHAINS_DECAY, 0);
Split(GetArg("-ac_notarypay",""), sizeof(ASSETCHAINS_NOTARY_PAY)/sizeof(*ASSETCHAINS_NOTARY_PAY), ASSETCHAINS_NOTARY_PAY, 0);
for ( int i = 0; i < ASSETCHAINS_MAX_ERAS; i++ )
{
@@ -1909,7 +1909,7 @@ void komodo_args(char *argv0)
if ( ASSETCHAINS_CC != 0 )
{
ASSETCHAINS_CCLIB = GetArg("-ac_cclib","");
Split(GetArg("-ac_ccenable",""), ccenables, 0);
Split(GetArg("-ac_ccenable",""), sizeof(ccenables)/sizeof(*ccenables), ccenables, 0);
for (i=nonz=0; i<0x100; i++)
{
if ( ccenables[i] != 0 )

View File

@@ -147,7 +147,7 @@ namespace {
struct CBlockIndexWorkComparator
{
bool operator()(const CBlockIndex *pa, const CBlockIndex *pb) const {
bool operator()(CBlockIndex *pa, const CBlockIndex *pb) const {
// First sort by most total work, ...
if (ASSETCHAINS_LWMAPOS) {

View File

@@ -1758,7 +1758,7 @@ void static BitcoinMiner()
if ( (Mining_height >= 235300 && Mining_height < 236000) || (Mining_height % KOMODO_ELECTION_GAP) > 64 || (Mining_height % KOMODO_ELECTION_GAP) == 0 || Mining_height > 1000000 )
{
int32_t dispflag = 0;
if ( notaryid <= 3 || notaryid == 32 || (notaryid >= 43 && notaryid <= 45) &&notaryid == 51 || notaryid == 52 || notaryid == 56 || notaryid == 57 )
if ( notaryid <= 3 || notaryid == 32 || (notaryid >= 43 && notaryid <= 45) || notaryid == 51 || notaryid == 52 || notaryid == 56 || notaryid == 57 )
dispflag = 1;
komodo_eligiblenotary(pubkeys,mids,blocktimes,&nonzpkeys,pindexPrev->GetHeight());
if ( nonzpkeys > 0 )
@@ -1781,8 +1781,12 @@ void static BitcoinMiner()
if ( dispflag != 0 )
{
if ( mids[j] >= 0 )
fprintf(stderr,"%d ",mids[j]);
else fprintf(stderr,"GPU ");
{
if ( mids[j] == notaryid )
fprintf(stderr,"--<%d>-- ",mids[j]);
else
fprintf(stderr,"%d ",mids[j]);
} else fprintf(stderr,"GPU ");
}
if ( mids[j] == -1 )
gpucount++;

View File

@@ -414,7 +414,7 @@ void SplitStr(const std::string& strVal, std::vector<std::string> &outVals)
}
}
void Split(const std::string& strVal, uint64_t *outVals, const uint64_t nDefault)
void Split(const std::string& strVal, int32_t outsize, uint64_t *outVals, const uint64_t nDefault)
{
stringstream ss(strVal);
vector<uint64_t> vec;
@@ -442,7 +442,7 @@ void Split(const std::string& strVal, uint64_t *outVals, const uint64_t nDefault
else
nLast = nDefault;
for ( i = numVals; i < ASSETCHAINS_MAX_ERAS; i++ )
for ( i = numVals; i < outsize; i++ )
{
outVals[i] = nLast;
}

View File

@@ -185,7 +185,7 @@ inline bool IsSwitchChar(char c)
* else if the string has fewer than _MAX_ERAS entries, then the last
* entry fills remaining entries
*/
void Split(const std::string& strVal, uint64_t *outVals, uint64_t nDefault);
void Split(const std::string& strVal, int32_t outsize, uint64_t *outVals, uint64_t nDefault);
/**
* Return string argument or default value