From a35f7eee4371725e47f0d9b6d66a1e5ef812ba3e Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 4 Feb 2017 17:22:48 +0200 Subject: [PATCH 01/17] test --- README.md | 12 ++++++++++++ src/komodo_gateway.h | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 463c3f983..ddb6a044d 100644 --- a/README.md +++ b/README.md @@ -162,3 +162,15 @@ License ------- For license information see the file [COPYING](COPYING). + + +NOTE TO EXCHANGES: +https://bitcointalk.org/index.php?topic=1605144.msg17732151#msg17732151 +There is a small chance that an outbound transaction will give an error due to mismatched values in wallet calculations. There is a -exchange option that you can run komodod with, but make sure to have the entire transaction history under the same -exchange mode. Otherwise you will get wallet conflicts. + +To change modes: +a) backup all privkeys (launch komodod with -exportdir= and dumpwallet) +b) start a totally new sync including wallet.dat +c) stop it before it gets too far and import all the privkeys from a) +d) resume sync till it gets to chaintip + diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 2417f077e..488962158 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -704,7 +704,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 bitcoin_address(coinaddr,addrtype,rmd160,20); checktoshis = PAX_fiatdest(&seed,tokomodo,destaddr,pubkey33,coinaddr,kmdheight,base,fiatoshis); typestr = "deposit"; - if ( kmdheight <= height ) + //if ( kmdheight <= height ) { didstats = 0; if ( 0 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) @@ -769,7 +769,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 } else if ( seed != 0 && kmdheight > 182000 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) printf("pax %s deposit %.8f rejected kmdheight.%d %.8f KMD check %.8f seed.%llu\n",base,dstr(fiatoshis),kmdheight,dstr(value),dstr(checktoshis),(long long)seed); - } else printf("paxdeposit height.%d vs kmdheight.%d\n",height,kmdheight); + } //else printf("paxdeposit height.%d vs kmdheight.%d\n",height,kmdheight); } } else if ( opretbuf[0] == 'I' ) From c9ef1c89433c47787a75affa2302cbc2af97782d Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 4 Feb 2017 17:57:10 +0200 Subject: [PATCH 02/17] -exchange instructions --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ddb6a044d..36be47e98 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,16 @@ There is a small chance that an outbound transaction will give an error due to m To change modes: a) backup all privkeys (launch komodod with -exportdir= and dumpwallet) -b) start a totally new sync including wallet.dat -c) stop it before it gets too far and import all the privkeys from a) +b) start a totally new sync including wallet.dat, launch with same exportdir +c) stop it before it gets too far and import all the privkeys from a) using komodo-cli importwallet filename d) resume sync till it gets to chaintip +For example: +./komodod -exportdir=/tmp & +./komodo-cli dumpwallet example +./komodo-cli stop +mv ~/.komodo ~/.komodo.old && mkdir ~/.komodo && cp ~/.komodo.old/komodo.conf ~/.komodo.old/peers.dat ~/.komodo +./komodod -exchange -exportdir=/tmp & +./komodo-cli importwallet example + + From 02b021735a001ac43deacc2bd2e8f9e39416d111 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 4 Feb 2017 21:27:19 +0200 Subject: [PATCH 03/17] fix doc --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 36be47e98..28160dd6e 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,6 @@ For example: ./komodo-cli stop mv ~/.komodo ~/.komodo.old && mkdir ~/.komodo && cp ~/.komodo.old/komodo.conf ~/.komodo.old/peers.dat ~/.komodo ./komodod -exchange -exportdir=/tmp & -./komodo-cli importwallet example +./komodo-cli importwallet /tmp/example From 435a0ea80ba1434f86f38361c7e8b7ab23fa7627 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 5 Feb 2017 01:51:13 +0200 Subject: [PATCH 04/17] test --- src/komodo_gateway.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 488962158..2417f077e 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -704,7 +704,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 bitcoin_address(coinaddr,addrtype,rmd160,20); checktoshis = PAX_fiatdest(&seed,tokomodo,destaddr,pubkey33,coinaddr,kmdheight,base,fiatoshis); typestr = "deposit"; - //if ( kmdheight <= height ) + if ( kmdheight <= height ) { didstats = 0; if ( 0 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) @@ -769,7 +769,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 } else if ( seed != 0 && kmdheight > 182000 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) printf("pax %s deposit %.8f rejected kmdheight.%d %.8f KMD check %.8f seed.%llu\n",base,dstr(fiatoshis),kmdheight,dstr(value),dstr(checktoshis),(long long)seed); - } //else printf("paxdeposit height.%d vs kmdheight.%d\n",height,kmdheight); + } else printf("paxdeposit height.%d vs kmdheight.%d\n",height,kmdheight); } } else if ( opretbuf[0] == 'I' ) From 693f7b76040207d76c1c382312898cedd15afeca Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 5 Feb 2017 12:12:40 +0200 Subject: [PATCH 05/17] kolo test --- src/miner.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index f7851e75d..e2e42a067 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -562,7 +562,7 @@ void static BitcoinMiner(CWallet *pwallet) ); try { - //fprintf(stderr,"try %s Mining with %s\n",ASSETCHAINS_SYMBOL,solver.c_str()); + fprintf(stderr,"try %s Mining with %s\n",ASSETCHAINS_SYMBOL,solver.c_str()); while (true) { if (chainparams.MiningRequiresPeers()) @@ -571,7 +571,7 @@ void static BitcoinMiner(CWallet *pwallet) // break; // Busy-wait for the network to come online so we don't waste time mining // on an obsolete chain. In regtest mode we expect to fly solo. - //fprintf(stderr,"Wait for peers...\n"); + fprintf(stderr,"Wait for peers...\n"); do { bool fvNodesEmpty; { @@ -584,7 +584,7 @@ void static BitcoinMiner(CWallet *pwallet) //fprintf(stderr,"fvNodesEmpty %d IsInitialBlockDownload(%s) %d\n",(int32_t)fvNodesEmpty,ASSETCHAINS_SYMBOL,(int32_t)IsInitialBlockDownload()); } while (true); - //fprintf(stderr,"%s Found peers\n",ASSETCHAINS_SYMBOL); + fprintf(stderr,"%s Found peers\n",ASSETCHAINS_SYMBOL); } /*while ( ASSETCHAINS_SYMBOL[0] != 0 && chainActive.Tip()->nHeight < ASSETCHAINS_MINHEIGHT ) { @@ -601,7 +601,7 @@ void static BitcoinMiner(CWallet *pwallet) Mining_height = pindexPrev->nHeight+1; Mining_start = (uint32_t)time(NULL); } - if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + //if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) fprintf(stderr,"%s create new block ht.%d\n",ASSETCHAINS_SYMBOL,Mining_height); unique_ptr pblocktemplate(CreateNewBlockWithKey(reservekey)); @@ -624,6 +624,9 @@ void static BitcoinMiner(CWallet *pwallet) if ( (Mining_height % KOMODO_ELECTION_GAP) > 64 || (Mining_height % KOMODO_ELECTION_GAP) == 0 ) { komodo_eligiblenotary(pubkeys,mids,&nonzpkeys,pindexPrev->nHeight); + for (j=0; j<65; j++) + fprintf(stderr,"%d ",mids[j]); + fprintf(stderr," <- prev minerids from ht.%d notary.%d\n",pindexPrev->nHeight,notaryid); if ( nonzpkeys > 0 ) { for (i=0; i<33; i++) From 3607e409151341618b8332f72de5303427777d54 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 5 Feb 2017 12:19:24 +0200 Subject: [PATCH 06/17] revert --- src/miner.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index e2e42a067..f7851e75d 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -562,7 +562,7 @@ void static BitcoinMiner(CWallet *pwallet) ); try { - fprintf(stderr,"try %s Mining with %s\n",ASSETCHAINS_SYMBOL,solver.c_str()); + //fprintf(stderr,"try %s Mining with %s\n",ASSETCHAINS_SYMBOL,solver.c_str()); while (true) { if (chainparams.MiningRequiresPeers()) @@ -571,7 +571,7 @@ void static BitcoinMiner(CWallet *pwallet) // break; // Busy-wait for the network to come online so we don't waste time mining // on an obsolete chain. In regtest mode we expect to fly solo. - fprintf(stderr,"Wait for peers...\n"); + //fprintf(stderr,"Wait for peers...\n"); do { bool fvNodesEmpty; { @@ -584,7 +584,7 @@ void static BitcoinMiner(CWallet *pwallet) //fprintf(stderr,"fvNodesEmpty %d IsInitialBlockDownload(%s) %d\n",(int32_t)fvNodesEmpty,ASSETCHAINS_SYMBOL,(int32_t)IsInitialBlockDownload()); } while (true); - fprintf(stderr,"%s Found peers\n",ASSETCHAINS_SYMBOL); + //fprintf(stderr,"%s Found peers\n",ASSETCHAINS_SYMBOL); } /*while ( ASSETCHAINS_SYMBOL[0] != 0 && chainActive.Tip()->nHeight < ASSETCHAINS_MINHEIGHT ) { @@ -601,7 +601,7 @@ void static BitcoinMiner(CWallet *pwallet) Mining_height = pindexPrev->nHeight+1; Mining_start = (uint32_t)time(NULL); } - //if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) fprintf(stderr,"%s create new block ht.%d\n",ASSETCHAINS_SYMBOL,Mining_height); unique_ptr pblocktemplate(CreateNewBlockWithKey(reservekey)); @@ -624,9 +624,6 @@ void static BitcoinMiner(CWallet *pwallet) if ( (Mining_height % KOMODO_ELECTION_GAP) > 64 || (Mining_height % KOMODO_ELECTION_GAP) == 0 ) { komodo_eligiblenotary(pubkeys,mids,&nonzpkeys,pindexPrev->nHeight); - for (j=0; j<65; j++) - fprintf(stderr,"%d ",mids[j]); - fprintf(stderr," <- prev minerids from ht.%d notary.%d\n",pindexPrev->nHeight,notaryid); if ( nonzpkeys > 0 ) { for (i=0; i<33; i++) From 2c7ad758f0102e4cbf854eb87ce092953406c2f2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 5 Feb 2017 16:22:19 +0200 Subject: [PATCH 07/17] stats print --- src/miner.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index f7851e75d..7227c020e 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -616,7 +616,7 @@ void static BitcoinMiner(CWallet *pwallet) // // Search // - uint8_t pubkeys[66][33]; int mids[66],nonzpkeys,i,j,externalflag; uint32_t savebits; int64_t nStart = GetTime(); + uint8_t pubkeys[66][33]; int mids[66],gpucount,nonzpkeys,i,j,externalflag; uint32_t savebits; int64_t nStart = GetTime(); savebits = pblock->nBits; arith_uint256 hashTarget = arith_uint256().SetCompact(pblock->nBits); if ( ASSETCHAINS_SYMBOL[0] == 0 && notaryid >= 0 )//komodo_is_special(pindexPrev->nHeight+1,NOTARY_PUBKEY33) > 0 ) @@ -645,9 +645,13 @@ void static BitcoinMiner(CWallet *pwallet) printf("%02x",pubkeys[i][j]); printf(" p%d -> %d\n",i,komodo_minerid(pindexPrev->nHeight-i,pubkeys[i])); } - for (j=0; j<65; j++) + for (j=gpucount=0; j<65; j++) + { fprintf(stderr,"%d ",mids[j]); - fprintf(stderr," <- prev minerids from ht.%d notary.%d\n",pindexPrev->nHeight,notaryid); + if ( mids[j] == -1 ) + gpucount++; + } + fprintf(stderr," <- prev minerids from ht.%d notary.%d gpucount.%d %.2f%%\n",pindexPrev->nHeight,notaryid,gpucount,100.*(double)gpucount/j); } for (j=0; j<65; j++) if ( mids[j] == notaryid ) From f87150f4a1862a915cb9af83e59fe084c95ccb8e Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 5 Feb 2017 20:44:31 +0200 Subject: [PATCH 08/17] test --- src/wallet/wallet.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index e7034f851..605d0eb99 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2449,7 +2449,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int LogPrint("selectcoins", "SelectCoins() best subset: "); for (unsigned int i = 0; i < vValue.size(); i++) if (vfBest[i]) - LogPrint("selectcoins", "%s ", FormatMoney(vValue[i].first)); + LogPrint("selectcoins", "%s + %s, ", FormatMoney(vValue[i].first),FormatMoney(interests[i])); LogPrint("selectcoins", "total %s\n", FormatMoney(nBest)); } @@ -2480,6 +2480,8 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, setvout[out.i].nValue; + if ( KOMODO_EXCHANGEWALLET == 0 ) + value += out.tx->vout[out.i].interest; } if (value <= nTargetValue) { CAmount valueWithCoinbase = 0; @@ -2488,12 +2490,13 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, setvout[out.i].nValue; + if ( KOMODO_EXCHANGEWALLET == 0 ) + valueWithCoinbase += out.tx->vout[out.i].interest; } fNeedCoinbaseCoinsRet = (valueWithCoinbase >= nTargetValue); } } // coin control -> return all selected outputs (we want all to go into the transaction for sure) - *interestp = 0; if (coinControl && coinControl->HasSelected()) { BOOST_FOREACH(const COutput& out, vCoins) From 0c053c9ed53d064271d44a7020a967ecc1c07aed Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 5 Feb 2017 20:45:56 +0200 Subject: [PATCH 09/17] test --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 605d0eb99..80766e30b 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2657,7 +2657,7 @@ bool CWallet::CreateTransaction(const vector& vecSend, interest = 0; } CAmount nChange = (nValueIn - nValue + interest); -//fprintf(stderr,"wallet change %.8f (%.8f - %.8f) interest %.8f total %.8f\n",(double)nChange/COIN,(double)nValueIn/COIN,(double)nValue/COIN,(double)interest/COIN,(double)nTotalValue/COIN); +fprintf(stderr,"wallet change %.8f (%.8f - %.8f) interest %.8f total %.8f\n",(double)nChange/COIN,(double)nValueIn/COIN,(double)nValue/COIN,(double)interest/COIN,(double)nTotalValue/COIN); if (nSubtractFeeFromAmount == 0) nChange -= nFeeRet; From 7a90b9dd6b619b7d7bc06c209855900fb9c38fc9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 6 Feb 2017 10:16:12 +0200 Subject: [PATCH 10/17] maturity --- src/komodo_globals.h | 3 ++- src/main.cpp | 2 ++ src/qt/transactiondesc.cpp | 3 +++ src/txmempool.cpp | 3 +++ src/wallet/wallet.cpp | 3 +++ src/wallet/wallet.h | 2 +- 6 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index afe589e21..536fc0b5b 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -36,7 +36,8 @@ struct knotaries_entry *Pubkeys; struct komodo_state KOMODO_STATES[34]; -int COINBASE_MATURITY = 100; +#define _COINBASE_MATURITY 64 +int COINBASE_MATURITY = _COINBASE_MATURITY;//100; int32_t IS_KOMODO_NOTARY,KOMODO_REWIND,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET; std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES; diff --git a/src/main.cpp b/src/main.cpp index 42dff0ffa..679524628 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1860,6 +1860,8 @@ bool ContextualCheckInputs(const CTransaction& tx, CValidationState &state, cons // If prev is coinbase, check that it's matured if (coins->IsCoinBase()) { + if ( ASSETCHAINS_SYMBOL[0] == 0 ) + COINBASE_MATURITY = _COINBASE_MATURITY; if (nSpendHeight - coins->nHeight < COINBASE_MATURITY) { fprintf(stderr,"ContextualCheckInputs failure.1 i.%d of %d\n",i,(int32_t)tx.vin.size()); diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index d7ee3d4c7..d8a0a184b 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -264,6 +264,9 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco if (wtx.IsCoinBase()) { + extern char ASSETCHAINS_SYMBOL[]; + if ( ASSETCHAINS_SYMBOL[0] == 0 ) + COINBASE_MATURITY = _COINBASE_MATURITY; quint32 numBlocksToMaturity = COINBASE_MATURITY + 1; strHTML += "
" + tr("Generated coins must mature %1 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to \"not accepted\" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.").arg(QString::number(numBlocksToMaturity)) + "
"; } diff --git a/src/txmempool.cpp b/src/txmempool.cpp index e9c846485..cbb36094d 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -166,6 +166,9 @@ void CTxMemPool::remove(const CTransaction &origTx, std::list& rem void CTxMemPool::removeCoinbaseSpends(const CCoinsViewCache *pcoins, unsigned int nMemPoolHeight) { // Remove transactions spending a coinbase which are now immature + extern char ASSETCHAINS_SYMBOL[]; + if ( ASSETCHAINS_SYMBOL[0] == 0 ) + COINBASE_MATURITY = _COINBASE_MATURITY; LOCK(cs); list transactionsToRemove; for (std::map::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) { diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 80766e30b..fb53715e4 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3593,6 +3593,9 @@ 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()) return 0; return max(0, (COINBASE_MATURITY+1) - GetDepthInMainChain()); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index f7531ba8f..90e3a7f0e 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -58,7 +58,7 @@ static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000; //! Size of witness cache // Should be large enough that we can expect not to reorg beyond our cache // unless there is some exceptional network disruption. -static const unsigned int WITNESS_CACHE_SIZE = COINBASE_MATURITY+1; +static const unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+1; class CAccountingEntry; class CBlockIndex; From 997c2e88c1b999e0b20bc24cbceb83d5423cf818 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 6 Feb 2017 10:17:11 +0200 Subject: [PATCH 11/17] test --- src/wallet/wallet.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 90e3a7f0e..c587f30cb 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -58,6 +58,7 @@ static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000; //! Size of witness cache // Should be large enough that we can expect not to reorg beyond our cache // unless there is some exceptional network disruption. +#define _COINBASE_MATURITY 64 static const unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+1; class CAccountingEntry; From 1af20a8196652c130dab0c6978acce1bb9c75c8c Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 6 Feb 2017 10:22:03 +0200 Subject: [PATCH 12/17] test --- src/txmempool.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/txmempool.cpp b/src/txmempool.cpp index cbb36094d..6afaa8166 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -14,6 +14,7 @@ #include "util.h" #include "utilmoneystr.h" #include "version.h" +#define _COINBASE_MATURITY 64 using namespace std; From 7e2cbee18181bd85c1ca5bc3b797479312e3e19e Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 6 Feb 2017 10:32:30 +0200 Subject: [PATCH 13/17] test --- src/komodo_globals.h | 2 +- src/txmempool.cpp | 2 +- src/wallet/wallet.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 536fc0b5b..833169626 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -36,7 +36,7 @@ struct knotaries_entry *Pubkeys; struct komodo_state KOMODO_STATES[34]; -#define _COINBASE_MATURITY 64 +#define _COINBASE_MATURITY 100 int COINBASE_MATURITY = _COINBASE_MATURITY;//100; int32_t IS_KOMODO_NOTARY,KOMODO_REWIND,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET; diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 6afaa8166..e1bb80a08 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -14,7 +14,7 @@ #include "util.h" #include "utilmoneystr.h" #include "version.h" -#define _COINBASE_MATURITY 64 +#define _COINBASE_MATURITY 100 using namespace std; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index c587f30cb..c790198df 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -58,7 +58,7 @@ static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000; //! Size of witness cache // Should be large enough that we can expect not to reorg beyond our cache // unless there is some exceptional network disruption. -#define _COINBASE_MATURITY 64 +#define _COINBASE_MATURITY 100 static const unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+1; class CAccountingEntry; From 7d306d6460d30887e50ae6d77ebc3370e85315df Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 6 Feb 2017 11:06:20 +0200 Subject: [PATCH 14/17] test --- src/miner.cpp | 1 + src/wallet/wallet.cpp | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 7227c020e..6cb2f1308 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -688,6 +688,7 @@ void static BitcoinMiner(CWallet *pwallet) crypto_generichash_blake2b_update(&curr_state,pblock->nNonce.begin(),pblock->nNonce.size()); // (x_1, x_2, ...) = A(I, V, n, k) LogPrint("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString()); + fprintf(stderr,"running solver\n"); std::function)> validBlock = [&pblock, &hashTarget, &pwallet, &reservekey, &m_cs, &cancelSolver, &chainparams] (std::vector soln) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index fb53715e4..419f9dec3 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1639,8 +1639,7 @@ void CWalletTx::GetAmounts(list& listReceived, CTxDestination address; if (!ExtractDestination(txout.scriptPubKey, address)) { - LogPrintf("CWalletTx::GetAmounts: Unknown transaction type found, txid %s\n", - this->GetHash().ToString()); + //LogPrintf("CWalletTx::GetAmounts: Unknown transaction type found, txid %s\n",this->GetHash().ToString()); complains on the opreturns address = CNoDestination(); } From aad443346551180462a0571102c4de6a3eeecdf5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 6 Feb 2017 11:14:03 +0200 Subject: [PATCH 15/17] test --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index 6cb2f1308..334d6671f 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -688,7 +688,7 @@ void static BitcoinMiner(CWallet *pwallet) crypto_generichash_blake2b_update(&curr_state,pblock->nNonce.begin(),pblock->nNonce.size()); // (x_1, x_2, ...) = A(I, V, n, k) LogPrint("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString()); - fprintf(stderr,"running solver\n"); + //fprintf(stderr,"running solver\n"); std::function)> validBlock = [&pblock, &hashTarget, &pwallet, &reservekey, &m_cs, &cancelSolver, &chainparams] (std::vector soln) From fda5f849924a002a7cd83b11a40ad74a2c600e3b Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 6 Feb 2017 11:25:55 +0200 Subject: [PATCH 16/17] test --- src/miner.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 334d6671f..486251435 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -621,6 +621,7 @@ void static BitcoinMiner(CWallet *pwallet) arith_uint256 hashTarget = arith_uint256().SetCompact(pblock->nBits); if ( ASSETCHAINS_SYMBOL[0] == 0 && notaryid >= 0 )//komodo_is_special(pindexPrev->nHeight+1,NOTARY_PUBKEY33) > 0 ) { + j = 65; if ( (Mining_height % KOMODO_ELECTION_GAP) > 64 || (Mining_height % KOMODO_ELECTION_GAP) == 0 ) { komodo_eligiblenotary(pubkeys,mids,&nonzpkeys,pindexPrev->nHeight); @@ -656,12 +657,12 @@ void static BitcoinMiner(CWallet *pwallet) for (j=0; j<65; j++) if ( mids[j] == notaryid ) break; - if ( j == 65 ) - { - hashTarget = arith_uint256().SetCompact(KOMODO_MINDIFF_NBITS); - fprintf(stderr,"I am the chosen one for %s ht.%d\n",ASSETCHAINS_SYMBOL,pindexPrev->nHeight+1); - } //else fprintf(stderr,"duplicate at j.%d\n",j); } else fprintf(stderr,"no nonz pubkeys\n"); + if ( j == 65 ) + { + hashTarget = arith_uint256().SetCompact(KOMODO_MINDIFF_NBITS); + fprintf(stderr,"I am the chosen one for %s ht.%d\n",ASSETCHAINS_SYMBOL,pindexPrev->nHeight+1); + } //else fprintf(stderr,"duplicate at j.%d\n",j); } else Mining_start = 0; } else Mining_start = 0; while (true) From f2805cebcfb3c086cee5f84af8d786626d10f857 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 6 Feb 2017 14:27:01 +0200 Subject: [PATCH 17/17] test --- src/komodo_bitcoind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 706bde70f..e0f5f6e1a 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -653,7 +653,7 @@ int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *non duplicate++; } } - if ( i == 66 && duplicate == 0 && *nonzpkeysp > 0 ) + if ( i == 66 && duplicate == 0 && (height > 186233 || *nonzpkeysp > 0) ) return(1); else return(0); }