merge
This commit is contained in:
blackjok3r
2018-12-15 07:03:32 +08:00
19 changed files with 443 additions and 392 deletions

View File

@@ -124,7 +124,11 @@
},
{
"ac_name": "ZILLA",
"ac_supply": "11000000"
"ac_supply": "11000000",
"ac_sapling": "5000000",
"addnode": [
"51.68.215.104"
]
},
{
"ac_name": "RFOX",

View File

@@ -27,14 +27,14 @@ echo $pubkey
./komodod -pubkey=$pubkey -ac_name=BEER -ac_supply=100000000 -addnode=78.47.196.146 &
./komodod -pubkey=$pubkey -ac_name=PIZZA -ac_supply=100000000 -addnode=78.47.196.146 &
./komodod -pubkey=$pubkey -ac_name=NINJA -ac_supply=100000000 -addnode=78.47.196.146 &
./komodod -pubkey=$pubkey -ac_name=OOT -ac_supply=216000000 -ac_saplinig=5000000 -addnode=174.138.107.226 &
./komodod -pubkey=$pubkey -ac_name=OOT -ac_supply=216000000 -ac_sapling=5000000 -addnode=174.138.107.226 &
./komodod -pubkey=$pubkey -ac_name=BNTN -ac_supply=500000000 -addnode=94.130.169.205 &
./komodod -pubkey=$pubkey -ac_name=CHAIN -ac_supply=999999 -addnode=78.47.146.222 &
./komodod -pubkey=$pubkey -ac_name=PRLPAY -ac_supply=500000000 -addnode=13.250.226.125 &
./komodod -pubkey=$pubkey -ac_name=DSEC -ac_supply=7000000 -addnode=185.148.147.30 &
./komodod -pubkey=$pubkey -ac_name=GLXT -ac_supply=10000000000 -addnode=13.230.224.15 &
./komodod -pubkey=$pubkey -ac_name=EQL -ac_supply=500000000 -ac_ccactivate=205000 -addnode=46.101.124.153 &
./komodod -pubkey=$pubkey -ac_name=ZILLA -ac_supply=11000000 -addnode=54.39.23.248 &
./komodod -pubkey=$pubkey -ac_name=ZILLA -ac_supply=11000000 -ac_sapling=5000000 -addnode=51.68.215.104 &
./komodod -pubkey=$pubkey -ac_name=RFOX -ac_supply=1000000000 -ac_reward=100000000 -addnode=78.47.196.146 &
~/VerusCoin/src/komodod -pubkey=$pubkey -ac_name=VRSC -ac_algo=verushash -ac_cc=1 -ac_veruspos=50 -ac_supply=0 -ac_eras=3 -ac_reward=0,38400000000,2400000000 -ac_halving=1,43200,1051920 -ac_decay=100000000,0,0 -ac_end=10080,226080,0 -ac_timelockgte=19200000000 -ac_timeunlockfrom=129600 -ac_timeunlockto=1180800 -addnode=185.25.48.236 -addnode=185.64.105.111 &
./komodod -pubkey=$pubkey -ac_name=SEC -ac_cc=333 -ac_supply=1000000000 -addnode=185.148.145.43 &

View File

@@ -889,9 +889,9 @@ int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t blo
int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width)
{
int32_t i,j,n,nonz,numnotaries; CBlock block; CBlockIndex *pindex; uint8_t notarypubs33[64][33],pubkey33[33];
int32_t i,j,nonz,numnotaries; CBlock block; CBlockIndex *pindex; uint8_t notarypubs33[64][33],pubkey33[33];
numnotaries = komodo_notaries(notarypubs33,height,0);
for (i=nonz=0; i<width; i++,n++)
for (i=nonz=0; i<width; i++)
{
if ( height-i <= 0 )
continue;
@@ -1125,12 +1125,11 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height)
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 ( ASSETCHAINS_FOUNDERS_PERIOD != 0 )
if ( ASSETCHAINS_FOUNDERS > 1 )
{
if ( height % ASSETCHAINS_FOUNDERS_PERIOD == 0 )
commission = commission * ASSETCHAINS_FOUNDERS_PERIOD;
else
commission = 0;
if ( (height % ASSETCHAINS_FOUNDERS) == 0 )
commission = commission * ASSETCHAINS_FOUNDERS;
else commission = 0;
}
}
else
@@ -1807,7 +1806,9 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
if ( ASSETCHAINS_SCRIPTPUB.size() > 1 )
{
int32_t scriptlen; uint8_t scripthex[10000];
if ( ASSETCHAINS_SCRIPTPUB.size()/2 == pblock->vtx[0].vout[0].scriptPubKey.size() && scriptlen < sizeof(scripthex) )
script = (uint8_t *)&pblock->vtx[0].vout[0].scriptPubKey[0];
scriptlen = (int32_t)pblock->vtx[0].vout[0].scriptPubKey.size();
if ( ASSETCHAINS_SCRIPTPUB.size()/2 == scriptlen && scriptlen < sizeof(scripthex) )
{
decode_hex(scripthex,scriptlen,(char *)ASSETCHAINS_SCRIPTPUB.c_str());
if ( memcmp(scripthex,script,scriptlen) != 0 )

View File

@@ -44,7 +44,7 @@ struct komodo_state KOMODO_STATES[34];
#define _COINBASE_MATURITY 100
int COINBASE_MATURITY = _COINBASE_MATURITY;//100;
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_PERIOD;
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
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,WHITELIST_ADDRESS;
uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEYHASH[20],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,ASSETCHAINS_FOUNDERS,NUM_NOTARIES;
@@ -154,6 +154,8 @@ int64_t komodo_current_supply(uint32_t nHeight)
uint64_t lastEnd = j == 0 ? 0 : ASSETCHAINS_ENDSUBSIDY[j - 1];
uint64_t curEnd = ASSETCHAINS_ENDSUBSIDY[j] == 0 ? nHeight : nHeight > ASSETCHAINS_ENDSUBSIDY[j] ? ASSETCHAINS_ENDSUBSIDY[j] : nHeight;
uint64_t period = ASSETCHAINS_HALVING[j];
if ( period == 0 )
period = 210000;
uint32_t nSteps = (curEnd - lastEnd) / period;
uint32_t modulo = (curEnd - lastEnd) % period;
uint64_t decay = ASSETCHAINS_DECAY[j];
@@ -207,7 +209,8 @@ int64_t komodo_current_supply(uint32_t nHeight)
// calculate amount in one step's triangular protrusion over minor triangle's hypotenuse
denominator = nSteps * period;
if ( denominator == 0 )
denominator = 1;
// difference of one step vs. total
stepDifference = (period * subsidyDifference) / denominator;

View File

@@ -1500,6 +1500,9 @@ uint32_t komodo_assetmagic(char *symbol,uint64_t supply,uint8_t *extraptr,int32_
{
vcalc_sha256(0,hash.bytes,extraptr,extralen);
crc0 = hash.uints[0];
int32_t i; for (i=0; i<extralen; i++)
fprintf(stderr,"%02x",extraptr[i]);
fprintf(stderr," extralen.%d crc0.%x\n",extralen,crc0);
}
return(calc_crc32(crc0,buf,len));
}
@@ -1767,12 +1770,17 @@ void komodo_args(char *argv0)
MAX_BLOCK_SIGOPS = 60000;
ASSETCHAINS_TXPOW = GetArg("-ac_txpow",0) & 3;
ASSETCHAINS_FOUNDERS = GetArg("-ac_founders",0) & 1;
ASSETCHAINS_FOUNDERS = GetArg("-ac_founders",0);// & 1;
ASSETCHAINS_SUPPLY = GetArg("-ac_supply",10);
ASSETCHAINS_COMMISSION = GetArg("-ac_perc",0);
ASSETCHAINS_OVERRIDE_PUBKEY = GetArg("-ac_pubkey","");
<<<<<<< HEAD
ASSETCHAINS_SCRIPTPUB = GetArg("-ac_script","");
ASSETCHAINS_FOUNDERS_PERIOD = GetArg("-ac_period",0);
=======
ASSETCHAINS_SCRIPTPUB = GetArg("-ac_script","");
//ASSETCHAINS_FOUNDERS_PERIOD = GetArg("-ac_period",0);
>>>>>>> 655ef3c8ae43446c2cd361677699dcbe37f8fea4
if ( (ASSETCHAINS_STAKED= GetArg("-ac_staked",0)) > 100 )
ASSETCHAINS_STAKED = 100;
@@ -1827,7 +1835,7 @@ void komodo_args(char *argv0)
}
if ( ASSETCHAINS_ENDSUBSIDY[0] != 0 || ASSETCHAINS_REWARD[0] != 0 || ASSETCHAINS_HALVING[0] != 0 || ASSETCHAINS_DECAY[0] != 0 || ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_PUBLIC != 0 || ASSETCHAINS_PRIVATE != 0 || ASSETCHAINS_TXPOW != 0 || ASSETCHAINS_FOUNDERS != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1 )
{
fprintf(stderr,"perc %.4f%% ac_pub=[%02x%02x%02x...]\n",dstr(ASSETCHAINS_COMMISSION)*100,ASSETCHAINS_OVERRIDE_PUBKEY33[0],ASSETCHAINS_OVERRIDE_PUBKEY33[1],ASSETCHAINS_OVERRIDE_PUBKEY33[2]);
fprintf(stderr,"perc %.4f%% ac_pub=[%02x%02x%02x...] acsize.%d\n",dstr(ASSETCHAINS_COMMISSION)*100,ASSETCHAINS_OVERRIDE_PUBKEY33[0],ASSETCHAINS_OVERRIDE_PUBKEY33[1],ASSETCHAINS_OVERRIDE_PUBKEY33[2],(int32_t)ASSETCHAINS_SCRIPTPUB.size());
extraptr = extrabuf;
memcpy(extraptr,ASSETCHAINS_OVERRIDE_PUBKEY33,33), extralen = 33;
@@ -1874,13 +1882,19 @@ void komodo_args(char *argv0)
val = ASSETCHAINS_COMMISSION | (((uint64_t)ASSETCHAINS_STAKED & 0xff) << 32) | (((uint64_t)ASSETCHAINS_CC & 0xffff) << 40) | ((ASSETCHAINS_PUBLIC != 0) << 7) | ((ASSETCHAINS_PRIVATE != 0) << 6) | ASSETCHAINS_TXPOW;
extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(val),(void *)&val);
if ( ASSETCHAINS_FOUNDERS != 0 )
{
extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_FOUNDERS),(void *)&ASSETCHAINS_FOUNDERS);
if ( ASSETCHAINS_FOUNDERS_PERIOD != 0 )
extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_FOUNDERS_PERIOD),(void *)&ASSETCHAINS_FOUNDERS_PERIOD);
}
{
uint8_t tmp = 1;
extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(tmp),(void *)&tmp);
if ( ASSETCHAINS_FOUNDERS > 1 )
extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_FOUNDERS),(void *)&ASSETCHAINS_FOUNDERS);
}
if ( ASSETCHAINS_SCRIPTPUB.size() > 1 )
extralen += iguana_rwnum(1,&extraptr[extralen],(int32_t)ASSETCHAINS_SCRIPTPUB.size(),(void *)ASSETCHAINS_SCRIPTPUB.c_str());
{
decode_hex(&extraptr[extralen],ASSETCHAINS_SCRIPTPUB.size()/2,(char *)ASSETCHAINS_SCRIPTPUB.c_str());
extralen += ASSETCHAINS_SCRIPTPUB.size()/2;
//extralen += iguana_rwnum(1,&extraptr[extralen],(int32_t)ASSETCHAINS_SCRIPTPUB.size(),(void *)ASSETCHAINS_SCRIPTPUB.c_str());
fprintf(stderr,"append ac_script %s\n",ASSETCHAINS_SCRIPTPUB.c_str());
}
}
addn = GetArg("-seednode","");
@@ -1907,11 +1921,11 @@ void komodo_args(char *argv0)
while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 )
{
fprintf(stderr,"waiting for datadir\n");
#ifndef _WIN32
#ifndef _WIN32
sleep(3);
#else
boost::this_thread::sleep(boost::posix_time::milliseconds(3000));
#endif
#else
boost::this_thread::sleep(boost::posix_time::milliseconds(3000));
#endif
}
//fprintf(stderr,"Got datadir.(%s)\n",dirname);
if ( ASSETCHAINS_SYMBOL[0] != 0 )

View File

@@ -4737,7 +4737,8 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
int32_t i,j,rejects=0,lastrejects=0;
//fprintf(stderr,"put block's tx into mempool\n");
// Copy all non Z-txs in mempool to temporary mempool because there can be tx in local mempool that make the block invalid.
LOCK(mempool.cs);
LOCK2(cs_main,mempool.cs);
//fprintf(stderr, "starting... mempoolsize.%ld\n",mempool.size());
list<CTransaction> transactionsToRemove;
BOOST_FOREACH(const CTxMemPoolEntry& e, mempool.mapTx) {
const CTransaction &tx = e.GetTx();
@@ -4755,6 +4756,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
// CC validation shouldnt (cant) depend on the state of mempool!
while ( 1 )
{
list<CTransaction> removed;
for (i=0; i<block.vtx.size(); i++)
{
CValidationState state;
@@ -4774,7 +4776,10 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
ptx = &sTx;
} else rejects++;
}
// here we remove any txs in the temp mempool that were included in the block.
tmpmempool.remove(tx, removed, false);
}
//fprintf(stderr, "removed.%ld\n",removed.size());
if ( rejects == 0 || rejects == lastrejects )
{
if ( 0 && lastrejects != 0 )
@@ -4821,29 +4826,15 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
if ( ASSETCHAINS_CC != 0 )
{
// here we add back all txs from the temp mempool to the main mempool.
// which removes any tx locally that were invalid after the block arrives.
int numadded,numiters = 0;
CValidationState state; bool fMissingInputs,fOverrideFees = false;
list<CTransaction> removed;
LOCK(mempool.cs);
while ( 1 )
BOOST_FOREACH(const CTxMemPoolEntry& e, tmpmempool.mapTx)
{
numiters++;
numadded = 0;
BOOST_FOREACH(const CTxMemPoolEntry& e, tmpmempool.mapTx)
{
CTransaction tx = e.GetTx();
if (AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !fOverrideFees) == true )
{
numadded++;
tmpmempool.remove(tx, removed, false);
}
const CTransaction &tx = e.GetTx();
const uint256 &hash = tx.GetHash();
if ( tx.vjoinsplit.size() == 0 ) {
mempool.addUnchecked(hash,e,true);
}
if ( numadded == 0 )
break;
}
if ( 0 && numadded > 0 )
fprintf(stderr, "CC mempool add: numiters.%d numadded.%d remains.%d\n",numiters,numadded,(int32_t)tmpmempool.size());
//fprintf(stderr, "finished adding back. mempoolsize.%ld\n",mempool.size());
// empty the temp mempool for next time.
tmpmempool.clear();
}

View File

@@ -149,7 +149,7 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
CPubKey pk = CPubKey();
std::vector<std::vector<unsigned char>> vAddrs;
txnouttype txT;
if (Solver(scriptPubKeyIn, txT, vAddrs))
if ( scriptPubKeyIn.size() > 0 && Solver(scriptPubKeyIn, txT, vAddrs))
{
if (txT == TX_PUBKEY)
pk = CPubKey(vAddrs[0]);

View File

@@ -1506,13 +1506,18 @@ void ThreadOpenAddedConnections()
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
for (list<vector<CService> >::iterator it = lservAddressesToAdd.begin(); it != lservAddressesToAdd.end(); it++)
{
BOOST_FOREACH(const CService& addrNode, *(it))
if (pnode->addr == addrNode)
{
it = lservAddressesToAdd.erase(it);
it--;
if ( it != lservAddressesToAdd.begin() )
it--;
break;
}
if (it == lservAddressesToAdd.end())
break;
}
}
BOOST_FOREACH(vector<CService>& vserv, lservAddressesToAdd)
{