From 7020df9139d60dac63172ca885b34c14a890d5c8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 17 Apr 2017 10:18:22 +0300 Subject: [PATCH 1/8] New mesh --- src/assetchains | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/assetchains b/src/assetchains index 8905a9eb7..453cab621 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=999999 -addnode=78.47.196.146 $1 -gen & sleep $delay ./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 & From bfb634f2238c01c7fa782b6c5b79f5e6f207ded3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 17 Apr 2017 17:24:00 +0300 Subject: [PATCH 2/8] Increment number of note witness cache --- src/wallet/wallet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index ccba41065..d52f547d0 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+2; class CAccountingEntry; class CBlockIndex; From e9e7e410efcaf7f864b6a3d3f2343ed3fbb44bca Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 17 Apr 2017 17:33:52 +0300 Subject: [PATCH 3/8] Test --- src/wallet/wallet.cpp | 3 +++ src/wallet/wallet.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 5f78be478..fc8160bb4 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) { diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index d52f547d0..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+2; +static const unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+10; class CAccountingEntry; class CBlockIndex; From 0fff4d5e3fdda0f133c01fd3a85d83eeb3c67d5d Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 18 Apr 2017 08:58:41 +0300 Subject: [PATCH 4/8] Newer mesh --- src/assetchains | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assetchains b/src/assetchains index 453cab621..a85cdbe38 100755 --- a/src/assetchains +++ b/src/assetchains @@ -19,7 +19,7 @@ echo $pubkey ./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=999999 -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 & From a7f86bc7abea98dd46eb09b54ff5c5b93ffe54a2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 18 Apr 2017 09:01:01 +0300 Subject: [PATCH 5/8] Remove print --- src/wallet/wallet.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index fc8160bb4..b1f543d5d 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -635,7 +635,7 @@ void CWallet::ClearNoteWitnessCache() } } nWitnessCacheSize = 0; - fprintf(stderr,"Clear witness cache\n"); + //fprintf(stderr,"Clear witness cache\n"); } void CWallet::IncrementNoteWitnesses(const CBlockIndex* pindex, @@ -670,7 +670,7 @@ void CWallet::IncrementNoteWitnesses(const CBlockIndex* pindex, } } if (nWitnessCacheSize < WITNESS_CACHE_SIZE) { - fprintf(stderr,"increment nWitnesscache -> %d\n",(int32_t)nWitnessCacheSize); + //fprintf(stderr,"increment nWitnesscache -> %d\n",(int32_t)nWitnessCacheSize); nWitnessCacheSize += 1; } @@ -784,7 +784,7 @@ void CWallet::DecrementNoteWitnesses(const CBlockIndex* pindex) } } } - fprintf(stderr,"decrement witness cache -> %d\n",(int32_t)nWitnessCacheSize); + //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) { From 8a382987c499ed53d638626f177fcdee4831294f Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 18 Apr 2017 15:55:45 +0300 Subject: [PATCH 6/8] Test --- src/komodo_kv.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/komodo_kv.h b/src/komodo_kv.h index 1ed6e1347..4d2163941 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); } From 6fc1969b951a00259cf74741b928cb48f8a61e3a Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 25 Apr 2017 18:07:32 +0300 Subject: [PATCH 7/8] Investigate kv crash --- src/komodo_kv.h | 5 +++++ src/wallet/wallet.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/komodo_kv.h b/src/komodo_kv.h index 4d2163941..3e03ca3af 100644 --- a/src/komodo_kv.h +++ b/src/komodo_kv.h @@ -104,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); + retrurn; + } 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 b1f543d5d..d1b007805 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2764,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); From f2b068bd42d25c9d43777d21217a6791188d2f1b Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 25 Apr 2017 18:13:23 +0300 Subject: [PATCH 8/8] Test --- src/komodo_kv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_kv.h b/src/komodo_kv.h index 3e03ca3af..046863822 100644 --- a/src/komodo_kv.h +++ b/src/komodo_kv.h @@ -107,7 +107,7 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value) if ( keylen+13 > opretlen ) { printf("komodo_kvupdate: keylen.%d + 13 > opretlen.%d\n",keylen,opretlen); - retrurn; + return; } valueptr = &key[keylen]; fee = komodo_kvfee(flags,opretlen,keylen);