From 3ce2f4ec500cf863d8132c6f2a19a8887251cd80 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 10 Nov 2018 18:19:01 +0800 Subject: [PATCH 01/25] try ignore 0 sat coinbase --- src/wallet/wallet.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index ea47c39c1..e86c54ae2 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1209,6 +1209,11 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { { AssertLockHeld(cs_wallet); + if ( tx.IsCoinBase() && tx.vout[0].nValue == 0 ) + { + fprintf(stderr, "ZERO sat coinbase, ignored!\n"); + return false; + } bool fExisted = mapWallet.count(tx.GetHash()) != 0; if (fExisted && !fUpdate) return false; auto noteData = FindMyNotes(tx); From bf554eb6cff6042787ead1ef9abdc4e601776cc2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 10 Nov 2018 18:45:39 +0800 Subject: [PATCH 02/25] remove print ... 0 sat coinbase ignore is working --- src/wallet/wallet.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index e86c54ae2..96ec88e6e 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1210,10 +1210,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { AssertLockHeld(cs_wallet); if ( tx.IsCoinBase() && tx.vout[0].nValue == 0 ) - { - fprintf(stderr, "ZERO sat coinbase, ignored!\n"); return false; - } bool fExisted = mapWallet.count(tx.GetHash()) != 0; if (fExisted && !fUpdate) return false; auto noteData = FindMyNotes(tx); From 9f4d613cf365801c0389b70945a3b42bb9e58d66 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 10 Nov 2018 19:40:34 +0800 Subject: [PATCH 03/25] add Bar_F1sh_Rel .. move PoSPerc to debug.log add longest chain miner back --- src/miner.cpp | 12 ++++++------ src/notaries_staked.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 5aef46148..ce5021cde 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -979,20 +979,20 @@ void static BitcoinMiner() HASHTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow); if ( ASSETCHAINS_STAKED < 100 ) { - for (z=31; z>=0; z--) - fprintf(stderr,"%02x",((uint8_t *)&HASHTarget_POW)[z]); - fprintf(stderr," PoW for staked coin PoS %d%% vs target %d%%\n",percPoS,(int32_t)ASSETCHAINS_STAKED); + //for (z=31; z>=0; z--) + // fprintf(stderr,"%02x",((uint8_t *)&HASHTarget_POW)[z]); + LogPrintf("Block %d : PoS %d%% vs target %d%% \n",Mining_height,percPoS,(int32_t)ASSETCHAINS_STAKED); } } while (true) { - /*if ( KOMODO_INSYNC == 0 && Mining_height > ASSETCHAINS_MINHEIGHT ) + if ( KOMODO_INSYNC == 0 && KOMODO_LONGESTCHAIN != 0 ) { fprintf(stderr,"Mining when blockchain might not be in sync longest.%d vs %d\n",KOMODO_LONGESTCHAIN,Mining_height); if ( KOMODO_LONGESTCHAIN != 0 && Mining_height >= KOMODO_LONGESTCHAIN ) KOMODO_INSYNC = 1; sleep(3); - } */ + } // Hash state KOMODO_CHOSEN_ONE = 0; crypto_generichash_blake2b_state state; @@ -1008,7 +1008,7 @@ void static BitcoinMiner() curr_state = state; 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()); + LogPrintf("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString()); arith_uint256 hashTarget; if ( KOMODO_MININGTHREADS > 0 && ASSETCHAINS_STAKED > 0 && ASSETCHAINS_STAKED < 100 && Mining_height > 10 ) hashTarget = HASHTarget_POW; diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index e4e1c8ddb..bb2289a17 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -22,7 +22,7 @@ const char *notaries_STAKED1[][2] = {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL - {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 + {"Bar_F1sh_Rel", "0395f2d9dd9ccb78caf74bff49b6d959afb95af746462e1b35f4a167d8e82b3666" }, // RBbLxJagCA9QHDazQvfnDZe874V1K4Gu8t {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca From a573cd9e263c0f6bf4ea07fa837068779d74057d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 10 Nov 2018 20:00:04 +0800 Subject: [PATCH 04/25] remove +1 sat for staked chains, needs ot be tested! --- src/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index c4fb3b6e9..590e3569f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3188,7 +3188,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin else fprintf(stderr,"checktoshis %.8f numvouts %d\n",dstr(checktoshis),(int32_t)block.vtx[0].vout.size()); } } - if ( block.vtx[0].GetValueOut() > blockReward+1 ) + + if ( ( block.vtx[0].GetValueOut() > blockReward+1 && is_STAKED(ASSETCHAINS_SYMBOL) != 0 ) || ( block.vtx[0].GetValueOut() > blockReward ) ) { if ( ASSETCHAINS_SYMBOL[0] != 0 || pindex->nHeight >= KOMODO_NOTARIES_HEIGHT1 || block.vtx[0].vout[0].nValue > blockReward ) { From d10c7b83583314a4e8578aea222653835a1ddc91 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 10 Nov 2018 21:11:42 +0800 Subject: [PATCH 05/25] fix max money problem, maximum 1 million coins per export, minimum max money on fungible chains 1 milion. --- src/komodo_utils.h | 2 ++ src/rpccrosschain.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index d5ac096f5..188e62603 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1636,6 +1636,8 @@ void komodo_args(char *argv0) MAX_MONEY = (ASSETCHAINS_SUPPLY+100) * SATOSHIDEN; else MAX_MONEY = (ASSETCHAINS_SUPPLY+100) * SATOSHIDEN + ASSETCHAINS_REWARD * (ASSETCHAINS_ENDSUBSIDY==0 ? 10000000 : ASSETCHAINS_ENDSUBSIDY); MAX_MONEY += (MAX_MONEY * ASSETCHAINS_COMMISSION) / SATOSHIDEN; + if ( ASSETCHAINS_CC >= KOMODO_FIRSTFUNGIBLEID && MAX_MONEY < 1000000LL*SATOSHIDEN ) + MAX_MONEY = 1000000LL*COIN; //printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,ASSETCHAINS_SYMBOL,(double)MAX_MONEY/SATOSHIDEN); ASSETCHAINS_P2PPORT = komodo_port(ASSETCHAINS_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC,extraptr,extralen); while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 ) diff --git a/src/rpccrosschain.cpp b/src/rpccrosschain.cpp index 52df5efaf..26edb575a 100644 --- a/src/rpccrosschain.cpp +++ b/src/rpccrosschain.cpp @@ -175,6 +175,8 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp) CAmount burnAmount = AmountFromValue(params[2]); if (burnAmount <= 0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for export"); + if (burnAmount > 1000000LL*COIN) + throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for export, cannot export more than 1 million coins per export."); { CAmount needed = 0; for (int i=0; i Date: Sat, 10 Nov 2018 21:19:15 +0800 Subject: [PATCH 06/25] fix --- src/komodo_defs.h | 1 + src/komodo_utils.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/komodo_defs.h b/src/komodo_defs.h index 1efd187d9..ca9a05c37 100644 --- a/src/komodo_defs.h +++ b/src/komodo_defs.h @@ -9,6 +9,7 @@ #define IGUANA_MAXSCRIPTSIZE 10001 #define KOMODO_MAXMEMPOOLTIME 3600 // affects consensus #define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9" +#define KOMODO_FIRSTFUNGIBLEID 100 extern uint8_t ASSETCHAINS_TXPOW; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 188e62603..962af99aa 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1637,7 +1637,7 @@ void komodo_args(char *argv0) else MAX_MONEY = (ASSETCHAINS_SUPPLY+100) * SATOSHIDEN + ASSETCHAINS_REWARD * (ASSETCHAINS_ENDSUBSIDY==0 ? 10000000 : ASSETCHAINS_ENDSUBSIDY); MAX_MONEY += (MAX_MONEY * ASSETCHAINS_COMMISSION) / SATOSHIDEN; if ( ASSETCHAINS_CC >= KOMODO_FIRSTFUNGIBLEID && MAX_MONEY < 1000000LL*SATOSHIDEN ) - MAX_MONEY = 1000000LL*COIN; + MAX_MONEY = 1000000LL*SATOSHIDEN; //printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,ASSETCHAINS_SYMBOL,(double)MAX_MONEY/SATOSHIDEN); ASSETCHAINS_P2PPORT = komodo_port(ASSETCHAINS_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC,extraptr,extralen); while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 ) From 973fa76710f704f5690a2f53e7a1c75f5985c5e4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 00:52:44 +0800 Subject: [PATCH 07/25] fix logprint, extra f ? --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index ce5021cde..c2b95178e 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -1008,7 +1008,7 @@ void static BitcoinMiner() curr_state = state; crypto_generichash_blake2b_update(&curr_state,pblock->nNonce.begin(),pblock->nNonce.size()); // (x_1, x_2, ...) = A(I, V, n, k) - LogPrintf("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString()); + LogPrint("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString()); arith_uint256 hashTarget; if ( KOMODO_MININGTHREADS > 0 && ASSETCHAINS_STAKED > 0 && ASSETCHAINS_STAKED < 100 && Mining_height > 10 ) hashTarget = HASHTarget_POW; From 1fe70b907a40043a5f8cf9f1b3e9927f75f4463f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 05:18:03 +0800 Subject: [PATCH 08/25] make coinbase normal tx --- src/rpcmining.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 0a2b56ca9..48c63aff1 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -673,8 +673,8 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) uint256 txHash = tx.GetHash(); setTxIndex[txHash] = i++; - if (tx.IsCoinBase() && !coinbasetxn) - continue; + //if (tx.IsCoinBase() && !coinbasetxn) + // continue; UniValue entry(UniValue::VOBJ); @@ -694,17 +694,17 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) entry.push_back(Pair("fee", pblocktemplate->vTxFees[index_in_template])); entry.push_back(Pair("sigops", pblocktemplate->vTxSigOps[index_in_template])); - if (tx.IsCoinBase()) { + //if (tx.IsCoinBase()) { // Show founders' reward if it is required //if (pblock->vtx[0].vout.size() > 1) { // Correct this if GetBlockTemplate changes the order // entry.push_back(Pair("foundersreward", (int64_t)tx.vout[1].nValue)); //} - CAmount nReward = GetBlockSubsidy(chainActive.LastTip()->nHeight+1, Params().GetConsensus()); - entry.push_back(Pair("coinbasevalue", nReward)); - entry.push_back(Pair("required", true)); - txCoinbase = entry; - } else + // CAmount nReward = GetBlockSubsidy(chainActive.LastTip()->nHeight+1, Params().GetConsensus()); + // entry.push_back(Pair("coinbasevalue", nReward)); + // entry.push_back(Pair("required", true)); + // txCoinbase = entry; + // } else transactions.push_back(entry); } @@ -726,13 +726,13 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) result.push_back(Pair("version", pblock->nVersion)); result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex())); result.push_back(Pair("transactions", transactions)); - if (coinbasetxn) { - assert(txCoinbase.isObject()); - result.push_back(Pair("coinbasetxn", txCoinbase)); - } else { - result.push_back(Pair("coinbaseaux", aux)); - result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue)); - } + //if (coinbasetxn) { + // assert(txCoinbase.isObject()); + // result.push_back(Pair("coinbasetxn", txCoinbase)); + //} else { + // result.push_back(Pair("coinbaseaux", aux)); + // result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue)); + //} result.push_back(Pair("longpollid", chainActive.LastTip()->GetBlockHash().GetHex() + i64tostr(nTransactionsUpdatedLast))); if ( ASSETCHAINS_STAKED != 0 ) { From 921b6a7d52d570a839a706db7b4ba5f7b5179fee Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 06:04:36 +0800 Subject: [PATCH 09/25] add disablecb option to getblocktemplate --- src/rpcmining.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 48c63aff1..7d5b2ebdc 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -518,7 +518,6 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) #endif } - std::string strMode = "template"; UniValue lpval = NullUniValue; // TODO: Re-enable coinbasevalue once a specification has been written bool coinbasetxn = true; @@ -530,12 +529,15 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) strMode = modeval.get_str(); else if (modeval.isNull()) { - /* Do nothing */ + std::string strMode = "template"; } else throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); lpval = find_value(oparam, "longpollid"); + if (strMode == "disablecb") + coinbasetxn = false; + if (strMode == "proposal") { const UniValue& dataval = find_value(oparam, "data"); @@ -567,7 +569,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) } } - if (strMode != "template") + if (strMode != "template" || strMode != "disablecb") throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); if (vNodes.empty()) @@ -694,17 +696,17 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) entry.push_back(Pair("fee", pblocktemplate->vTxFees[index_in_template])); entry.push_back(Pair("sigops", pblocktemplate->vTxSigOps[index_in_template])); - //if (tx.IsCoinBase()) { + if (tx.IsCoinBase() && coinbasetxn == true ) { // Show founders' reward if it is required //if (pblock->vtx[0].vout.size() > 1) { // Correct this if GetBlockTemplate changes the order // entry.push_back(Pair("foundersreward", (int64_t)tx.vout[1].nValue)); //} - // CAmount nReward = GetBlockSubsidy(chainActive.LastTip()->nHeight+1, Params().GetConsensus()); - // entry.push_back(Pair("coinbasevalue", nReward)); - // entry.push_back(Pair("required", true)); - // txCoinbase = entry; - // } else + CAmount nReward = GetBlockSubsidy(chainActive.LastTip()->nHeight+1, Params().GetConsensus()); + entry.push_back(Pair("coinbasevalue", nReward)); + entry.push_back(Pair("required", true)); + txCoinbase = entry; + } else transactions.push_back(entry); } @@ -726,12 +728,12 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) result.push_back(Pair("version", pblock->nVersion)); result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex())); result.push_back(Pair("transactions", transactions)); - //if (coinbasetxn) { - // assert(txCoinbase.isObject()); - // result.push_back(Pair("coinbasetxn", txCoinbase)); - //} else { - // result.push_back(Pair("coinbaseaux", aux)); - // result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue)); + if (coinbasetxn) { + assert(txCoinbase.isObject()); + result.push_back(Pair("coinbasetxn", txCoinbase)); + } // else { + // result.push_back(Pair("coinbaseaux", aux)); + // result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue)); //} result.push_back(Pair("longpollid", chainActive.LastTip()->GetBlockHash().GetHex() + i64tostr(nTransactionsUpdatedLast))); if ( ASSETCHAINS_STAKED != 0 ) From 2205820299eefee6bdedbcb2188cd07e2bc51124 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 06:11:19 +0800 Subject: [PATCH 10/25] fix --- src/rpcmining.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 7d5b2ebdc..a3d7a5893 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -521,6 +521,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) UniValue lpval = NullUniValue; // TODO: Re-enable coinbasevalue once a specification has been written bool coinbasetxn = true; + std::string strMode; if (params.size() > 0) { const UniValue& oparam = params[0].get_obj(); @@ -529,7 +530,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) strMode = modeval.get_str(); else if (modeval.isNull()) { - std::string strMode = "template"; + strMode = "template"; } else throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); From 4129000ec324cf9bd23678307b4d176d12c52092 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 06:23:51 +0800 Subject: [PATCH 11/25] print --- src/rpcmining.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index a3d7a5893..944879120 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -528,6 +528,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) const UniValue& modeval = find_value(oparam, "mode"); if (modeval.isStr()) strMode = modeval.get_str(); + fprintf(stderr, "%s\n",strMode); else if (modeval.isNull()) { strMode = "template"; From 3354f67d5d576fafd16453fcc4c1b398d56c298b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 06:25:19 +0800 Subject: [PATCH 12/25] fix --- src/rpcmining.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 944879120..cb421b9e0 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -528,7 +528,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) const UniValue& modeval = find_value(oparam, "mode"); if (modeval.isStr()) strMode = modeval.get_str(); - fprintf(stderr, "%s\n",strMode); + fprintf(stderr, "%s\n",strMode.c_str()); else if (modeval.isNull()) { strMode = "template"; From b6f711b69d3e0a0d702537a50b66c84ed5b03b9b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 06:26:36 +0800 Subject: [PATCH 13/25] fix --- src/rpcmining.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index cb421b9e0..b317190dd 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -526,9 +526,10 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) { const UniValue& oparam = params[0].get_obj(); const UniValue& modeval = find_value(oparam, "mode"); - if (modeval.isStr()) + if (modeval.isStr()) { strMode = modeval.get_str(); - fprintf(stderr, "%s\n",strMode.c_str()); + fprintf(stderr, "%s\n",strMode.c_str()); + } else if (modeval.isNull()) { strMode = "template"; From 1d3226eafa4934936fae8fba749835c081750204 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 06:29:06 +0800 Subject: [PATCH 14/25] fix --- src/rpcmining.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index b317190dd..ad2058fd5 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -526,10 +526,8 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) { const UniValue& oparam = params[0].get_obj(); const UniValue& modeval = find_value(oparam, "mode"); - if (modeval.isStr()) { + if (modeval.isStr()) strMode = modeval.get_str(); - fprintf(stderr, "%s\n",strMode.c_str()); - } else if (modeval.isNull()) { strMode = "template"; @@ -571,6 +569,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) return BIP22ValidationResult(state); } } + fprintf(stderr, "%s\n",strMode.c_str()); if (strMode != "template" || strMode != "disablecb") throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); From 47bc56ea6a88664e7d14b69e2fe3095e03824964 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 06:32:53 +0800 Subject: [PATCH 15/25] fix? --- src/rpcmining.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index ad2058fd5..907d13ada 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -569,10 +569,11 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) return BIP22ValidationResult(state); } } - fprintf(stderr, "%s\n",strMode.c_str()); + if (coinbasetxn == false ) + fprintf(stderr, "disable coinbase: %s\n",strMode.c_str()); - if (strMode != "template" || strMode != "disablecb") - throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); + //if (strMode != "template" || strMode != "disablecb") + // throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); if (vNodes.empty()) throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Komodo is not connected!"); From 7e45307718c3f325f550fae104f79da27d991629 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 06:35:30 +0800 Subject: [PATCH 16/25] done --- src/rpcmining.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 907d13ada..d3f0563f8 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -569,11 +569,6 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) return BIP22ValidationResult(state); } } - if (coinbasetxn == false ) - fprintf(stderr, "disable coinbase: %s\n",strMode.c_str()); - - //if (strMode != "template" || strMode != "disablecb") - // throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); if (vNodes.empty()) throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Komodo is not connected!"); From 2016042c79ad810dfdd92c06c36da7e8cdfa1241 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 13:16:56 +0800 Subject: [PATCH 17/25] fix! lol --- src/notaries_staked.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index ae16e316d..51124be23 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -7,9 +7,9 @@ static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1541498901; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1541500201; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1541501501; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1604211111; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1604222222; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1604233333; static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; extern const char *notaries_STAKED1[][2]; From 677d4f9b5053791a804a86c908948894ff54fe6e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 14:23:46 +0800 Subject: [PATCH 18/25] remove vin,vins --- src/wallet/rpcwallet.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 8a62b2153..3d5d41871 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1074,12 +1074,18 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) } if ( spents == mine ) { - TxToRemove.push_back(wtx.GetHash()); for (unsigned int n = 0; n < wtx.vin.size() ; n++) { - if ( pwalletMain->IsMine(wtx.vin[n]) ) - TxToRemove.push_back(wtx.vin[n].prevout.hash); + //if ( pwalletMain->IsMine(wtx.vin[n]) ) + CTransaction vintx; uint256 hashBlock; + if ( GetTransaction(wtx.vin[n].prevout.hash,vintx,hashBlock,false) != 0 ) + { + for (unsigned int z = 0; z < vintx.vin.size() ; z++) + TxToRemove.push_back(vintx.vin[z].prevout.hash); + } + TxToRemove.push_back(wtx.vin[n].prevout.hash); } + TxToRemove.push_back(wtx.GetHash()); } } From 13a5aa70a7c6e2be3d327820da9ba81dbc901797 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 15:10:41 +0800 Subject: [PATCH 19/25] print --- src/wallet/rpcwallet.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 3d5d41871..a393a0518 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1058,7 +1058,8 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; - if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 50 ) + fprintf(stderr, "depth in main chain: %d\n", wtx.GetDepthInMainChain()); + if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 360 ) continue; CCoins coins; From 462acd24ab3a84a2365190a992beb40f13d2aef5 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 15:21:38 +0800 Subject: [PATCH 20/25] fix print --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a393a0518..688675d71 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1058,7 +1058,7 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; - fprintf(stderr, "depth in main chain: %d\n", wtx.GetDepthInMainChain()); + fprintf(stderr, "[%s] depth : %d\n", wtx.GetHash().ToString().c_str(),wtx.GetDepthInMainChain()); if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 360 ) continue; From 2e4ff8898f7d13bd7363d559eb62ad776b3595f4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 15:32:28 +0800 Subject: [PATCH 21/25] try --- src/wallet/rpcwallet.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 688675d71..725cba3a0 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1059,7 +1059,7 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) { const CWalletTx& wtx = (*it).second; fprintf(stderr, "[%s] depth : %d\n", wtx.GetHash().ToString().c_str(),wtx.GetDepthInMainChain()); - if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 360 ) + if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() > 360 ) continue; CCoins coins; @@ -1082,7 +1082,10 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) if ( GetTransaction(wtx.vin[n].prevout.hash,vintx,hashBlock,false) != 0 ) { for (unsigned int z = 0; z < vintx.vin.size() ; z++) - TxToRemove.push_back(vintx.vin[z].prevout.hash); + { + fprintf(stderr, "[ %s ] depth : %d\n", vintx.GetHash().ToString().c_str(),vintx.GetDepthInMainChain()); + TxToRemove.push_back(vintx.vin[z].prevout.hash); + } } TxToRemove.push_back(wtx.vin[n].prevout.hash); } From e0383c82b916480011fb55de8e5a696005d3b855 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 15:35:50 +0800 Subject: [PATCH 22/25] fix --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 725cba3a0..d89368ba5 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1083,7 +1083,7 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) { for (unsigned int z = 0; z < vintx.vin.size() ; z++) { - fprintf(stderr, "[ %s ] depth : %d\n", vintx.GetHash().ToString().c_str(),vintx.GetDepthInMainChain()); + fprintf(stderr, "TX: %s in block : %s\n", vintx.GetHash().ToString().c_str(),hashBlock.ToString().c_str(); TxToRemove.push_back(vintx.vin[z].prevout.hash); } } From 025924e9ffc8a9ce2da2dc89685f364f659537b3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 15:36:54 +0800 Subject: [PATCH 23/25] ) --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index d89368ba5..f9ac24016 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1083,7 +1083,7 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) { for (unsigned int z = 0; z < vintx.vin.size() ; z++) { - fprintf(stderr, "TX: %s in block : %s\n", vintx.GetHash().ToString().c_str(),hashBlock.ToString().c_str(); + fprintf(stderr, "TX: %s in block : %s\n", vintx.GetHash().ToString().c_str(),hashBlock.ToString().c_str()); TxToRemove.push_back(vintx.vin[z].prevout.hash); } } From 4d6499bd8d737b9bb95818bf13b7aaf0c8463744 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 15:42:26 +0800 Subject: [PATCH 24/25] fix --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index f9ac24016..e7a7a2953 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1059,7 +1059,7 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) { const CWalletTx& wtx = (*it).second; fprintf(stderr, "[%s] depth : %d\n", wtx.GetHash().ToString().c_str(),wtx.GetDepthInMainChain()); - if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() > 360 ) + if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 360 ) continue; CCoins coins; From 2e91034c1ec168edecec4d6b5c7c65a659f4af91 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 15:57:40 +0800 Subject: [PATCH 25/25] LogPrintf the removed txs --- src/wallet/rpcwallet.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index e7a7a2953..238744805 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1058,7 +1058,6 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; - fprintf(stderr, "[%s] depth : %d\n", wtx.GetHash().ToString().c_str(),wtx.GetDepthInMainChain()); if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 360 ) continue; @@ -1077,13 +1076,11 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) { for (unsigned int n = 0; n < wtx.vin.size() ; n++) { - //if ( pwalletMain->IsMine(wtx.vin[n]) ) CTransaction vintx; uint256 hashBlock; if ( GetTransaction(wtx.vin[n].prevout.hash,vintx,hashBlock,false) != 0 ) { for (unsigned int z = 0; z < vintx.vin.size() ; z++) { - fprintf(stderr, "TX: %s in block : %s\n", vintx.GetHash().ToString().c_str(),hashBlock.ToString().c_str()); TxToRemove.push_back(vintx.vin[z].prevout.hash); } } @@ -1112,7 +1109,7 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) if ( SpentHash == tx.vin[n].prevout.hash ) { pwalletMain->EraseFromWallet(tx.GetHash()); - //fprintf(stderr, "ERASED Notarisation: %s\n",tx.GetHash().ToString().c_str()); + LogPrintf("ERASED Notarisation: %s\n",tx.GetHash().ToString().c_str()); } } } @@ -1123,7 +1120,7 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) BOOST_FOREACH (uint256& hash, TxToRemove) { pwalletMain->EraseFromWallet(hash); - //fprintf(stderr, "ERASED spent Tx: %s\n",hash.ToString().c_str()); + LogPrintf("ERASED spent Tx: %s\n",hash.ToString().c_str()); } // build return JSON for stats.