@@ -16,11 +16,10 @@ echo $pubkey
|
||||
./komodod -pubkey=$pubkey -ac_name=BOTS -ac_supply=999999 -addnode=78.47.196.146 $1 -gen &
|
||||
./komodod -pubkey=$pubkey -ac_name=MGW -ac_supply=999999 -addnode=78.47.196.146 $1 -gen &
|
||||
./komodod -pubkey=$pubkey -ac_name=MVP -ac_supply=1000000 -addnode=78.47.196.146 $1 -gen &
|
||||
#./komodod -pubkey=$pubkey -ac_name=WIRELESS -ac_supply=21000000 -addnode=78.47.196.146 $1 &
|
||||
./komodod -pubkey=$pubkey -ac_name=WLC -ac_supply=210000000 -addnode=148.251.190.89 $1 -gen &
|
||||
./komodod -pubkey=$pubkey -ac_name=KV -ac_supply=1000000 -addnode=78.47.196.146 $1 -gen &
|
||||
./komodod -pubkey=$pubkey -ac_name=CEAL -ac_supply=366666666 -addnode=78.47.196.146 $1 -gen &
|
||||
./komodod -pubkey=$pubkey -ac_name=MESH -ac_supply=1000001 -addnode=78.47.196.146 $1 -gen &
|
||||
./komodod -pubkey=$pubkey -ac_name=MESH -ac_supply=1000006 -addnode=78.47.196.146 $1 -gen &
|
||||
sleep $delay
|
||||
|
||||
./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 &
|
||||
|
||||
@@ -553,6 +553,7 @@ uint32_t komodo_txtime(uint256 hash)
|
||||
void komodo_disconnect(CBlockIndex *pindex,CBlock& block)
|
||||
{
|
||||
char symbol[16],dest[16]; struct komodo_state *sp;
|
||||
//fprintf(stderr,"disconnect ht.%d\n",pindex->nHeight);
|
||||
komodo_init(pindex->nHeight);
|
||||
if ( (sp= komodo_stateptr(symbol,dest)) != 0 )
|
||||
{
|
||||
|
||||
@@ -83,11 +83,15 @@ int32_t komodo_kvsearch(uint256 *pubkeyp,int32_t current_height,uint32_t *flagsp
|
||||
}
|
||||
//printf(" ptr->pubkey\n");
|
||||
memcpy(pubkeyp,&ptr->pubkey,sizeof(*pubkeyp));
|
||||
if ( (retval= ptr->valuesize) != 0 )
|
||||
if ( (retval= ptr->valuesize) > 0 )
|
||||
memcpy(value,ptr->value,retval);
|
||||
}
|
||||
}
|
||||
portable_mutex_unlock(&KOMODO_KV_mutex);
|
||||
if ( retval < 0 )
|
||||
{
|
||||
// search rawmempool
|
||||
}
|
||||
return(retval);
|
||||
}
|
||||
|
||||
@@ -100,6 +104,11 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value)
|
||||
iguana_rwnum(0,&opretbuf[5],sizeof(height),&height);
|
||||
iguana_rwnum(0,&opretbuf[9],sizeof(flags),&flags);
|
||||
key = &opretbuf[13];
|
||||
if ( keylen+13 > opretlen )
|
||||
{
|
||||
printf("komodo_kvupdate: keylen.%d + 13 > opretlen.%d\n",keylen,opretlen);
|
||||
return;
|
||||
}
|
||||
valueptr = &key[keylen];
|
||||
fee = komodo_kvfee(flags,opretlen,keylen);
|
||||
//printf("fee %.8f vs %.8f flags.%d keylen.%d valuesize.%d height.%d (%02x %02x %02x) (%02x %02x %02x)\n",(double)fee/COIN,(double)value/COIN,flags,keylen,valuesize,height,key[0],key[1],key[2],valueptr[0],valueptr[1],valueptr[2]);
|
||||
@@ -178,7 +187,7 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value)
|
||||
ptr->flags = flags | 1;
|
||||
portable_mutex_unlock(&KOMODO_KV_mutex);
|
||||
} //else printf("size mismatch %d vs %d\n",opretlen,coresize);
|
||||
} else printf("insufficient fee %.8f vs %.8f flags.%d keylen.%d valuesize.%d height.%d (%02x %02x %02x) (%02x %02x %02x)\n",(double)fee/COIN,(double)value/COIN,flags,keylen,valuesize,height,key[0],key[1],key[2],valueptr[0],valueptr[1],valueptr[2]);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1565,7 +1565,7 @@ bool IsInitialBlockDownload()
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
||||
state = ((chainActive.Height() < ptr->nHeight - 24*60) ||
|
||||
ptr->GetBlockTime() < (GetTime() - chainParams.MaxTipAge()));
|
||||
else state = (chainActive.Height() < ptr->nHeight - 3);
|
||||
else state = (chainActive.Height() < ptr->nHeight - 10);
|
||||
//fprintf(stderr,"state.%d ht.%d vs %d, t.%u %u\n",state,(int32_t)chainActive.Height(),(uint32_t)ptr->nHeight,(int32_t)ptr->GetBlockTime(),(uint32_t)(GetTime() - chainParams.MaxTipAge()));
|
||||
if (!state)
|
||||
{
|
||||
@@ -2231,6 +2231,7 @@ static int64_t nTimeTotal = 0;
|
||||
bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, bool fJustCheck)
|
||||
{
|
||||
const CChainParams& chainparams = Params();
|
||||
//fprintf(stderr,"connectblock ht.%d\n",(int32_t)pindex->nHeight);
|
||||
AssertLockHeld(cs_main);
|
||||
/*<<<<<<< HEA
|
||||
// Check it again in case a previous version let a bad block in
|
||||
@@ -2659,6 +2660,7 @@ bool static DisconnectTip(CValidationState &state) {
|
||||
SyncWithWallets(tx, NULL);
|
||||
}
|
||||
// Update cached incremental witnesses
|
||||
//fprintf(stderr,"chaintip false\n");
|
||||
GetMainSignals().ChainTip(pindexDelete, &block, newTree, false);
|
||||
return true;
|
||||
}
|
||||
@@ -2729,6 +2731,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
|
||||
SyncWithWallets(tx, pblock);
|
||||
}
|
||||
// Update cached incremental witnesses
|
||||
//fprintf(stderr,"chaintip true\n");
|
||||
GetMainSignals().ChainTip(pindexNew, pblock, oldTree, true);
|
||||
|
||||
int64_t nTime6 = GetTimeMicros(); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1;
|
||||
|
||||
@@ -106,7 +106,7 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams,
|
||||
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, consensusParams);
|
||||
}
|
||||
|
||||
#define ASSETCHAINS_MINHEIGHT 100
|
||||
#define ASSETCHAINS_MINHEIGHT 128
|
||||
#define KOMODO_ELECTION_GAP 2000
|
||||
#define ROUNDROBIN_DELAY 61
|
||||
extern int32_t ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE;
|
||||
@@ -451,6 +451,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
||||
return pblocktemplate.release();
|
||||
}
|
||||
|
||||
/*
|
||||
#ifdef ENABLE_WALLET
|
||||
boost::optional<CScript> GetMinerScriptPubKey(CReserveKey& reservekey)
|
||||
#else
|
||||
@@ -477,7 +478,7 @@ boost::optional<CScript> GetMinerScriptPubKey()
|
||||
return scriptPubKey;
|
||||
}
|
||||
|
||||
/*#ifdef ENABLE_WALLET
|
||||
#ifdef ENABLE_WALLET
|
||||
CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
|
||||
{
|
||||
boost::optional<CScript> scriptPubKey = GetMinerScriptPubKey(reservekey);
|
||||
@@ -596,6 +597,7 @@ static bool ProcessBlockFound(CBlock* pblock)
|
||||
}
|
||||
}
|
||||
// Track how many getdata requests this block gets
|
||||
//if ( 0 )
|
||||
{
|
||||
LOCK(wallet.cs_wallet);
|
||||
wallet.mapRequestCount[pblock->GetHash()] = 0;
|
||||
@@ -640,12 +642,13 @@ void static BitcoinMiner()
|
||||
unsigned int n = chainparams.EquihashN();
|
||||
unsigned int k = chainparams.EquihashK();
|
||||
int32_t notaryid = -1;
|
||||
while ( (ASSETCHAIN_INIT == 0 || KOMODO_INITDONE == 0) ) //chainActive.Tip()->nHeight != 235300 &&
|
||||
while ( (ASSETCHAIN_INIT == 0 || KOMODO_INITDONE == 0) ) //chainActive.Tip()->nHeight != 235300 &&
|
||||
{
|
||||
sleep(1);
|
||||
if ( komodo_baseid(ASSETCHAINS_SYMBOL) < 0 )
|
||||
break;
|
||||
}
|
||||
//sleep(60);
|
||||
komodo_chosennotary(¬aryid,chainActive.Tip()->nHeight,NOTARY_PUBKEY33);
|
||||
|
||||
std::string solver;
|
||||
@@ -708,8 +711,11 @@ void static BitcoinMiner()
|
||||
Mining_height = pindexPrev->nHeight+1;
|
||||
Mining_start = (uint32_t)time(NULL);
|
||||
}
|
||||
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
fprintf(stderr,"%s create new block ht.%d\n",ASSETCHAINS_SYMBOL,Mining_height);
|
||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
{
|
||||
//fprintf(stderr,"%s create new block ht.%d\n",ASSETCHAINS_SYMBOL,Mining_height);
|
||||
sleep(3);
|
||||
}
|
||||
#ifdef ENABLE_WALLET
|
||||
CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey);
|
||||
#else
|
||||
@@ -862,6 +868,8 @@ void static BitcoinMiner()
|
||||
sleep(nseconds);
|
||||
MilliSleep((rand() % 1700) + 1);
|
||||
}
|
||||
else if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
sleep(3);
|
||||
KOMODO_CHOSEN_ONE = 1;
|
||||
// Found a solution
|
||||
SetThreadPriority(THREAD_PRIORITY_NORMAL);
|
||||
|
||||
@@ -38,6 +38,7 @@ bool bSpendZeroConfChange = true;
|
||||
bool fSendFreeTransactions = false;
|
||||
bool fPayAtLeastCustomFee = true;
|
||||
extern int32_t KOMODO_EXCHANGEWALLET;
|
||||
extern char ASSETCHAINS_SYMBOL[16];
|
||||
|
||||
/**
|
||||
* Fees smaller than this (in satoshi) are considered zero fee (for transaction creation)
|
||||
@@ -373,9 +374,9 @@ void CWallet::ChainTip(const CBlockIndex *pindex, const CBlock *pblock,
|
||||
{
|
||||
if (added) {
|
||||
IncrementNoteWitnesses(pindex, pblock, tree);
|
||||
} else {
|
||||
} else if ( ASSETCHAINS_SYMBOL[0] == 0 || nWitnessCacheSize > 1 ){
|
||||
DecrementNoteWitnesses(pindex);
|
||||
}
|
||||
} else fprintf(stderr,"would have decremented %s nWitnessCacheSize.%d\n",ASSETCHAINS_SYMBOL,(int32_t)nWitnessCacheSize);
|
||||
}
|
||||
|
||||
void CWallet::SetBestChain(const CBlockLocator& loc)
|
||||
@@ -635,12 +636,14 @@ void CWallet::ClearNoteWitnessCache()
|
||||
}
|
||||
}
|
||||
nWitnessCacheSize = 0;
|
||||
//fprintf(stderr,"Clear witness cache\n");
|
||||
}
|
||||
|
||||
void CWallet::IncrementNoteWitnesses(const CBlockIndex* pindex,
|
||||
const CBlock* pblockIn,
|
||||
ZCIncrementalMerkleTree& tree)
|
||||
{
|
||||
//fprintf(stderr,"A increment witness cache -> %d\n",(int32_t)nWitnessCacheSize);
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
||||
@@ -669,6 +672,7 @@ void CWallet::IncrementNoteWitnesses(const CBlockIndex* pindex,
|
||||
}
|
||||
}
|
||||
if (nWitnessCacheSize < WITNESS_CACHE_SIZE) {
|
||||
//fprintf(stderr,"increment nWitnesscache -> %d\n",(int32_t)nWitnessCacheSize);
|
||||
nWitnessCacheSize += 1;
|
||||
}
|
||||
|
||||
@@ -782,7 +786,13 @@ void CWallet::DecrementNoteWitnesses(const CBlockIndex* pindex)
|
||||
}
|
||||
}
|
||||
}
|
||||
nWitnessCacheSize -= 1;
|
||||
//fprintf(stderr,"decrement witness cache -> %d\n",(int32_t)nWitnessCacheSize);
|
||||
if ( nWitnessCacheSize > 1 )
|
||||
nWitnessCacheSize -= 1;
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"%s nWitnessCacheSize.%d\n",ASSETCHAINS_SYMBOL,(int32_t)nWitnessCacheSize);
|
||||
}
|
||||
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
||||
for (mapNoteData_t::value_type& item : wtxItem.second.mapNoteData) {
|
||||
CNoteData* nd = &(item.second);
|
||||
@@ -801,11 +811,6 @@ void CWallet::DecrementNoteWitnesses(const CBlockIndex* pindex)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( nWitnessCacheSize <= 0 )
|
||||
{
|
||||
extern char ASSETCHAINS_SYMBOL[16];
|
||||
fprintf(stderr,"%s nWitnessCacheSize.%d\n",ASSETCHAINS_SYMBOL,(int32_t)nWitnessCacheSize);
|
||||
}
|
||||
if ( KOMODO_REWIND == 0 )
|
||||
assert(nWitnessCacheSize > 0);
|
||||
//if (fFileBacked) {
|
||||
@@ -2237,7 +2242,6 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const
|
||||
{
|
||||
if ( KOMODO_EXCHANGEWALLET == 0 )
|
||||
{
|
||||
extern char ASSETCHAINS_SYMBOL[16];
|
||||
uint32_t locktime; int32_t txheight; CBlockIndex *tipindex;
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 && chainActive.Tip() != 0 && chainActive.Tip()->nHeight >= 60000 )
|
||||
{
|
||||
@@ -2761,7 +2765,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||
if ( KOMODO_EXCHANGEWALLET != 0 )
|
||||
{
|
||||
//fprintf(stderr,"KOMODO_EXCHANGEWALLET disable interest sum %.8f, interest2 %.8f\n",(double)interest/COIN,(double)interest2/COIN);
|
||||
interest = 0;
|
||||
interest = 0; // interest2 also
|
||||
}
|
||||
CAmount nChange = (nValueIn - nValue + interest2);
|
||||
fprintf(stderr,"wallet change %.8f (%.8f - %.8f) interest %.8f interest2 %.8f total %.8f\n",(double)nChange/COIN,(double)nValueIn/COIN,(double)nValue/COIN,(double)interest2/COIN,(double)interest/COIN,(double)nTotalValue/COIN);
|
||||
@@ -3722,7 +3726,6 @@ int CMerkleTx::GetDepthInMainChain(const CBlockIndex* &pindexRet) const
|
||||
|
||||
int CMerkleTx::GetBlocksToMaturity() const
|
||||
{
|
||||
extern char ASSETCHAINS_SYMBOL[];
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
||||
COINBASE_MATURITY = _COINBASE_MATURITY;
|
||||
if (!IsCoinBase())
|
||||
|
||||
@@ -59,7 +59,7 @@ static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000;
|
||||
// Should be large enough that we can expect not to reorg beyond our cache
|
||||
// unless there is some exceptional network disruption.
|
||||
#define _COINBASE_MATURITY 100
|
||||
static const unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+1;
|
||||
static const unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+10;
|
||||
|
||||
class CAccountingEntry;
|
||||
class CBlockIndex;
|
||||
|
||||
Reference in New Issue
Block a user