Merge pull request #418 from jl777/dev

Dev
This commit is contained in:
jl777
2017-04-26 09:16:51 +03:00
committed by GitHub
4 changed files with 16 additions and 5 deletions

View File

@@ -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=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=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=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=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=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=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=1000007 -addnode=78.47.196.146 $1 -gen &
sleep $delay sleep $delay
./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 &

View File

@@ -83,11 +83,15 @@ int32_t komodo_kvsearch(uint256 *pubkeyp,int32_t current_height,uint32_t *flagsp
} }
//printf(" ptr->pubkey\n"); //printf(" ptr->pubkey\n");
memcpy(pubkeyp,&ptr->pubkey,sizeof(*pubkeyp)); memcpy(pubkeyp,&ptr->pubkey,sizeof(*pubkeyp));
if ( (retval= ptr->valuesize) != 0 ) if ( (retval= ptr->valuesize) > 0 )
memcpy(value,ptr->value,retval); memcpy(value,ptr->value,retval);
} }
} }
portable_mutex_unlock(&KOMODO_KV_mutex); portable_mutex_unlock(&KOMODO_KV_mutex);
if ( retval < 0 )
{
// search rawmempool
}
return(retval); 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[5],sizeof(height),&height);
iguana_rwnum(0,&opretbuf[9],sizeof(flags),&flags); iguana_rwnum(0,&opretbuf[9],sizeof(flags),&flags);
key = &opretbuf[13]; key = &opretbuf[13];
if ( keylen+13 > opretlen )
{
printf("komodo_kvupdate: keylen.%d + 13 > opretlen.%d\n",keylen,opretlen);
return;
}
valueptr = &key[keylen]; valueptr = &key[keylen];
fee = komodo_kvfee(flags,opretlen,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]); //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]);

View File

@@ -635,6 +635,7 @@ void CWallet::ClearNoteWitnessCache()
} }
} }
nWitnessCacheSize = 0; nWitnessCacheSize = 0;
//fprintf(stderr,"Clear witness cache\n");
} }
void CWallet::IncrementNoteWitnesses(const CBlockIndex* pindex, void CWallet::IncrementNoteWitnesses(const CBlockIndex* pindex,
@@ -669,6 +670,7 @@ void CWallet::IncrementNoteWitnesses(const CBlockIndex* pindex,
} }
} }
if (nWitnessCacheSize < WITNESS_CACHE_SIZE) { if (nWitnessCacheSize < WITNESS_CACHE_SIZE) {
//fprintf(stderr,"increment nWitnesscache -> %d\n",(int32_t)nWitnessCacheSize);
nWitnessCacheSize += 1; nWitnessCacheSize += 1;
} }
@@ -782,6 +784,7 @@ void CWallet::DecrementNoteWitnesses(const CBlockIndex* pindex)
} }
} }
} }
//fprintf(stderr,"decrement witness cache -> %d\n",(int32_t)nWitnessCacheSize);
nWitnessCacheSize -= 1; nWitnessCacheSize -= 1;
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) { for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
for (mapNoteData_t::value_type& item : wtxItem.second.mapNoteData) { for (mapNoteData_t::value_type& item : wtxItem.second.mapNoteData) {
@@ -2761,7 +2764,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
if ( KOMODO_EXCHANGEWALLET != 0 ) if ( KOMODO_EXCHANGEWALLET != 0 )
{ {
//fprintf(stderr,"KOMODO_EXCHANGEWALLET disable interest sum %.8f, interest2 %.8f\n",(double)interest/COIN,(double)interest2/COIN); //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); 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); 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);

View File

@@ -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 // Should be large enough that we can expect not to reorg beyond our cache
// unless there is some exceptional network disruption. // unless there is some exceptional network disruption.
#define _COINBASE_MATURITY 100 #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 CAccountingEntry;
class CBlockIndex; class CBlockIndex;