diff --git a/src/assetchains b/src/assetchains index 8905a9eb7..a85cdbe38 100755 --- a/src/assetchains +++ b/src/assetchains @@ -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=1000007 -addnode=78.47.196.146 $1 -gen & sleep $delay ./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 & diff --git a/src/komodo_kv.h b/src/komodo_kv.h index 1ed6e1347..046863822 100644 --- a/src/komodo_kv.h +++ b/src/komodo_kv.h @@ -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]); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 5f78be478..d1b007805 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -635,6 +635,7 @@ void CWallet::ClearNoteWitnessCache() } } nWitnessCacheSize = 0; + //fprintf(stderr,"Clear witness cache\n"); } void CWallet::IncrementNoteWitnesses(const CBlockIndex* pindex, @@ -669,6 +670,7 @@ void CWallet::IncrementNoteWitnesses(const CBlockIndex* pindex, } } if (nWitnessCacheSize < WITNESS_CACHE_SIZE) { + //fprintf(stderr,"increment nWitnesscache -> %d\n",(int32_t)nWitnessCacheSize); nWitnessCacheSize += 1; } @@ -782,6 +784,7 @@ void CWallet::DecrementNoteWitnesses(const CBlockIndex* pindex) } } } + //fprintf(stderr,"decrement witness cache -> %d\n",(int32_t)nWitnessCacheSize); nWitnessCacheSize -= 1; for (std::pair& wtxItem : mapWallet) { for (mapNoteData_t::value_type& item : wtxItem.second.mapNoteData) { @@ -2761,7 +2764,7 @@ bool CWallet::CreateTransaction(const vector& 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); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index ccba41065..ed7edbbc1 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -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;