From c6df523fa4c8df404f0c1705bf79fc92057cc6c2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 06:02:32 +0300 Subject: [PATCH 01/19] Test --- src/komodo_bitcoind.h | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 6ce8c5355..a94ec3d77 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -730,17 +730,22 @@ int8_t komodo_minerid(int32_t height,uint8_t *pubkey33) int32_t num,i,numnotaries; CBlockIndex *pindex; uint32_t timestamp=0; uint8_t _pubkey33[33],pubkeys[64][33]; if ( pubkey33 == 0 && (pindex= chainActive[height]) != 0 ) { - timestamp = pindex->GetBlockTime(); - if ( pubkey33 == 0 ) + if ( pindex->pubkey33[0] == 0 ) { - pubkey33 = _pubkey33; + pindex->notaryid = -1; + timestamp = pindex->GetBlockTime(); + if ( pubkey33 == 0 ) + pubkey33 = _pubkey33; komodo_index2pubkey33(pubkey33,pindex,height); - } - if ( (num= komodo_notaries(pubkeys,height,timestamp)) > 0 ) - { - for (i=0; i 0 ) + { + for (i=0; inotaryid = i; + return(i); + } + } } } return(komodo_electednotary(&numnotaries,pubkey33,height,timestamp)); @@ -755,8 +760,6 @@ int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *non if ( (pindex= komodo_chainactive(height-i)) != 0 ) { komodo_index2pubkey33(pubkey33,pindex,height-i); - //for (j=0; j<33; j++) - // pubkeys[i][j] = pubkey33[j]; memcpy(pubkeys[i],pubkey33,33); if ( (mids[i]= komodo_minerid(height-i,pubkey33)) >= 0 ) { From eb7171f5609479f9f3adcf5e231006f1efe7624c Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 06:05:56 +0300 Subject: [PATCH 02/19] Test --- src/komodo_bitcoind.h | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index a94ec3d77..f0b88d065 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -730,22 +730,17 @@ int8_t komodo_minerid(int32_t height,uint8_t *pubkey33) int32_t num,i,numnotaries; CBlockIndex *pindex; uint32_t timestamp=0; uint8_t _pubkey33[33],pubkeys[64][33]; if ( pubkey33 == 0 && (pindex= chainActive[height]) != 0 ) { - if ( pindex->pubkey33[0] == 0 ) + timestamp = pindex->GetBlockTime(); + if ( pubkey33 == 0 ) { - pindex->notaryid = -1; - timestamp = pindex->GetBlockTime(); - if ( pubkey33 == 0 ) - pubkey33 = _pubkey33; + pubkey33 = _pubkey33; komodo_index2pubkey33(pubkey33,pindex,height); - if ( (num= komodo_notaries(pubkeys,height,timestamp)) > 0 ) - { - for (i=0; inotaryid = i; - return(i); - } - } + } + if ( (num= komodo_notaries(pubkeys,height,timestamp)) > 0 ) + { + for (i=0; i Date: Mon, 26 Mar 2018 13:17:49 +0300 Subject: [PATCH 03/19] Test --- src/komodo_bitcoind.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index f0b88d065..f4a20718d 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -700,13 +700,31 @@ uint32_t komodo_heightstamp(int32_t height) void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height) { - CBlock block; + CBlock block; int32_t num,i; uint8_t pubkeys[64][33]; //komodo_init(height); memset(pubkey33,0,33); if ( pindex != 0 ) { if ( komodo_blockload(block,pindex) == 0 ) + { komodo_block2pubkey33(pubkey33,block); + if ( pubkey33[0] == 2 || pubkey33[0] == 3 ) + { + memcpy(pindex->pubkey33,pubkey33,33); + if ( (num= komodo_notaries(pubkeys,height,timestamp)) > 0 ) + { + pindex->notaryid = -1; + for (i=0; inotaryid = i; + break; + } + } + } + } else pindex->notaryid = -1; + } } else { @@ -740,7 +758,11 @@ int8_t komodo_minerid(int32_t height,uint8_t *pubkey33) { for (i=0; ipubkey33[0] != 0 && (memcmp(pindex->pubkey33,pubkey33,33) != 0 || pindex->notaryid != i) ) + printf("mismatched notaryid.%d\n",pindex->notaryid) return(i); + } } } return(komodo_electednotary(&numnotaries,pubkey33,height,timestamp)); From 35998dd5ae6920fd85d537c864a2eeff304e5dc4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 13:18:44 +0300 Subject: [PATCH 04/19] 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 f4a20718d..a5044c003 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -760,7 +760,7 @@ int8_t komodo_minerid(int32_t height,uint8_t *pubkey33) if ( memcmp(pubkeys[i],pubkey33,33) == 0 ) { if ( pindex->pubkey33[0] != 0 && (memcmp(pindex->pubkey33,pubkey33,33) != 0 || pindex->notaryid != i) ) - printf("mismatched notaryid.%d\n",pindex->notaryid) + printf("mismatched notaryid.%d\n",pindex->notaryid); return(i); } } From a142cb4f7cfa730a8b6776302c4f2fa5bb7562c9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 13:20:00 +0300 Subject: [PATCH 05/19] 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 a5044c003..19f4be3e5 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -711,7 +711,7 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height) if ( pubkey33[0] == 2 || pubkey33[0] == 3 ) { memcpy(pindex->pubkey33,pubkey33,33); - if ( (num= komodo_notaries(pubkeys,height,timestamp)) > 0 ) + if ( (num= komodo_notaries(pubkeys,(int32_t)pindex->nHeight,(uint32_t)pindex->nTime)) > 0 ) { pindex->notaryid = -1; for (i=0; i Date: Mon, 26 Mar 2018 13:21:15 +0300 Subject: [PATCH 06/19] Test --- src/komodo_bitcoind.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 19f4be3e5..6c9a98840 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -25,6 +25,9 @@ #include "komodo_defs.h" +int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp); +int32_t komodo_electednotary(int32_t *numnotariesp,uint8_t *pubkey33,int32_t height,uint32_t timestamp); + //#define issue_curl(cmdstr) bitcoind_RPC(0,(char *)"curl",(char *)"http://127.0.0.1:7776",0,0,(char *)(cmdstr)) struct MemoryStruct { char *memory; size_t size; }; @@ -740,8 +743,6 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height) komodo_connectblock(pindex,block); }*/ -int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp); -int32_t komodo_electednotary(int32_t *numnotariesp,uint8_t *pubkey33,int32_t height,uint32_t timestamp); int8_t komodo_minerid(int32_t height,uint8_t *pubkey33) { From 3e7e31091257107f0fa4ac9c38848f248b1ad43e Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 13:41:46 +0300 Subject: [PATCH 07/19] Test --- src/komodo_bitcoind.h | 15 +++++++++++---- src/komodo_notary.h | 3 ++- src/miner.cpp | 9 +-------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 6c9a98840..62ae3f010 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -708,6 +708,11 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height) memset(pubkey33,0,33); if ( pindex != 0 ) { + if ( pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3 ) + { + memcpy(pubkey33,pindex->pubkey33,33); + return; + } if ( komodo_blockload(block,pindex) == 0 ) { komodo_block2pubkey33(pubkey33,block); @@ -747,7 +752,7 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height) int8_t komodo_minerid(int32_t height,uint8_t *pubkey33) { int32_t num,i,numnotaries; CBlockIndex *pindex; uint32_t timestamp=0; uint8_t _pubkey33[33],pubkeys[64][33]; - if ( pubkey33 == 0 && (pindex= chainActive[height]) != 0 ) + if ( (pindex= chainActive[height]) != 0 ) { timestamp = pindex->GetBlockTime(); if ( pubkey33 == 0 ) @@ -755,6 +760,8 @@ int8_t komodo_minerid(int32_t height,uint8_t *pubkey33) pubkey33 = _pubkey33; komodo_index2pubkey33(pubkey33,pindex,height); } + if ( pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3 ) + return(pindex->notaryid); if ( (num= komodo_notaries(pubkeys,height,timestamp)) > 0 ) { for (i=0; i= 225000 ) - komodo_chosennotary(¬aryid,height,_pubkey33,timestamp); + komodo_chosennotary(¬aryid,height,pubkey33,timestamp); if ( height >= 34000 && notaryid >= 0 ) { if ( height < 79693 ) @@ -819,7 +826,7 @@ int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp else limit = 66; for (i=1; i 0 ) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 4911b21d9..638327e81 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -339,7 +339,6 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33, { // -1 if not notary, 0 if notary, 1 if special notary struct knotary_entry *kp; int32_t numnotaries=0,htind,modval = -1; - komodo_init(0); *notaryidp = -1; if ( height < 0 )//|| height >= KOMODO_MAXBLOCKS ) { @@ -356,6 +355,8 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33, } if ( height >= 250000 ) return(-1); + if ( Pubkeys == 0 ) + komodo_init(0); htind = height / KOMODO_ELECTION_GAP; if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; diff --git a/src/miner.cpp b/src/miner.cpp index cc0c2423c..e820c42e5 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -112,7 +112,6 @@ extern std::string NOTARY_PUBKEY; extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33]; uint32_t Mining_start,Mining_height; int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp); -int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp); int32_t komodo_pax_opreturn(int32_t height,uint8_t *opret,int32_t maxsize); uint64_t komodo_paxtotal(); int32_t komodo_baseid(char *origbase); @@ -549,12 +548,6 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) script[34] = OP_CHECKSIG; //scriptPubKey = CScript() << ToByteVector(pubkey) << OP_CHECKSIG; } - if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) - { - for (i=0; i<65; i++) - fprintf(stderr,"%d ",komodo_minerid(chainActive.Tip()->nHeight-i,0)); - fprintf(stderr," minerids.special %d from ht.%d\n",komodo_is_special(chainActive.Tip()->nHeight+1,NOTARY_PUBKEY33,chainActive.Tip()->GetBlockTime()),chainActive.Tip()->nHeight); - } return CreateNewBlock(scriptPubKey); } @@ -762,7 +755,7 @@ void static BitcoinMiner() savebits = pblock->nBits; arith_uint256 hashTarget = arith_uint256().SetCompact(pblock->nBits); roundrobin_delay = ROUNDROBIN_DELAY; - if ( ASSETCHAINS_SYMBOL[0] == 0 && notaryid >= 0 )//komodo_is_special(pindexPrev->nHeight+1,NOTARY_PUBKEY33) > 0 ) + if ( ASSETCHAINS_SYMBOL[0] == 0 && notaryid >= 0 ) { j = 65; if ( (Mining_height >= 235300 && Mining_height < 236000) || (Mining_height % KOMODO_ELECTION_GAP) > 64 || (Mining_height % KOMODO_ELECTION_GAP) == 0 ) From 5e0e5f857127fa3cc0a7c1bc0c3a825cd5d43983 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 13:57:33 +0300 Subject: [PATCH 08/19] Faster --- src/komodo_bitcoind.h | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 62ae3f010..d7a467b44 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -754,23 +754,20 @@ int8_t komodo_minerid(int32_t height,uint8_t *pubkey33) int32_t num,i,numnotaries; CBlockIndex *pindex; uint32_t timestamp=0; uint8_t _pubkey33[33],pubkeys[64][33]; if ( (pindex= chainActive[height]) != 0 ) { - timestamp = pindex->GetBlockTime(); - if ( pubkey33 == 0 ) - { - pubkey33 = _pubkey33; - komodo_index2pubkey33(pubkey33,pindex,height); - } if ( pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3 ) + { + if ( pubkey33 != 0 ) + memcpy(pubkey33,pindex->pubkey33,33); return(pindex->notaryid); + } + if ( pubkey33 != 0 ) + komodo_index2pubkey33(pubkey33,pindex,height); + timestamp = pindex->GetBlockTime(); if ( (num= komodo_notaries(pubkeys,height,timestamp)) > 0 ) { for (i=0; ipubkey33[0] != 0 && (memcmp(pindex->pubkey33,pubkey33,33) != 0 || pindex->notaryid != i) ) - printf("mismatched notaryid.%d\n",pindex->notaryid); return(i); - } } } return(komodo_electednotary(&numnotaries,pubkey33,height,timestamp)); @@ -784,13 +781,22 @@ int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *non { if ( (pindex= komodo_chainactive(height-i)) != 0 ) { - komodo_index2pubkey33(pubkey33,pindex,height-i); - memcpy(pubkeys[i],pubkey33,33); - if ( (mids[i]= komodo_minerid(height-i,pubkey33)) >= 0 ) + if ( pindex->notaryid >= 0 && (pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3) ) { - //mids[i] = *(int32_t *)pubkey33; + memcpy(pubkeys[i],pindex->pubkey33,33); + mids[i] = pindex->notaryid; (*nonzpkeysp)++; } + else + { + komodo_index2pubkey33(pubkey33,pindex,height-i); + memcpy(pubkeys[i],pubkey33,33); + if ( (mids[i]= komodo_minerid(height-i,pubkey33)) >= 0 ) + { + //mids[i] = *(int32_t *)pubkey33; + (*nonzpkeysp)++; + } + } if ( mids[0] >= 0 && i > 0 && mids[i] == mids[0] ) duplicate++; } From 7890185e9a1505785b9956e4e21621ccbde6c150 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 14:23:46 +0300 Subject: [PATCH 09/19] Test --- src/pow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pow.cpp b/src/pow.cpp index 0190ccfb2..4765699d4 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -169,7 +169,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in // Check proof of work matches claimed amount if ( UintToArith256(hash) > bnTarget ) { - if ( (height < 235300 || height >= 236000) && KOMODO_LOADINGBLOCKS == 0 && height > 188000 ) + if ( 0 && (height < 235300 || height >= 236000) && KOMODO_LOADINGBLOCKS == 0 && height > 188000 ) //&& )//186269, 182507&& komodo_chainactive(height) != 0 && nonzpkeys > 0 { for (i=31; i>=0; i--) From 60aee10df5780212e7e4a47bc2b8919aaa8bfea8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 14:40:11 +0300 Subject: [PATCH 10/19] Test --- src/main.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 0cd831b5b..8c4d6abd6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -751,7 +751,7 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime) } else if (!txin.IsFinal()) { - printf("non-final txin seq.%x locktime.%u vs nTime.%u\n",txin.nSequence,(uint32_t)tx.nLockTime,(uint32_t)nBlockTime); + //printf("non-final txin seq.%x locktime.%u vs nTime.%u\n",txin.nSequence,(uint32_t)tx.nLockTime,(uint32_t)nBlockTime); return false; } } @@ -1345,7 +1345,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa // are the joinsplit's requirements met? if (!view.HaveJoinSplitRequirements(tx)) { - fprintf(stderr,"accept failure.2\n"); + //fprintf(stderr,"accept failure.2\n"); return state.Invalid(error("AcceptToMemoryPool: joinsplit requirements not met"),REJECT_DUPLICATE, "bad-txns-joinsplit-requirements-not-met"); } @@ -1455,7 +1455,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa PrecomputedTransactionData txdata(tx); if (!ContextualCheckInputs(tx, state, view, true, STANDARD_SCRIPT_VERIFY_FLAGS, true, txdata, Params().GetConsensus(), consensusBranchId)) { - fprintf(stderr,"accept failure.9\n"); + //fprintf(stderr,"accept failure.9\n"); return error("AcceptToMemoryPool: ConnectInputs failed %s", hash.ToString()); } @@ -1993,7 +1993,7 @@ bool CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoins int64_t interest; int32_t txheight; uint32_t locktime; if ( (interest= komodo_accrued_interest(&txheight,&locktime,prevout.hash,prevout.n,0,coins->vout[prevout.n].nValue)) != 0 ) { - //fprintf(stderr,"checkResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nValueIn/COIN,(double)coins->vout[prevout.n].nValue/COIN,(double)interest/COIN,txheight,locktime,chainActive.Tip()->nTime); +fprintf(stderr,"checkResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nValueIn/COIN,(double)coins->vout[prevout.n].nValue/COIN,(double)interest/COIN,txheight,locktime,chainActive.Tip()->nTime); nValueIn += interest; } } @@ -2011,9 +2011,11 @@ bool CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoins REJECT_INVALID, "bad-txns-inputvalues-outofrange"); if (nValueIn < tx.GetValueOut()) + { + fprintf(stderr,"valuein %s vs %s error\n",FormatMoney(nValueIn), FormatMoney(tx.GetValueOut())); return state.DoS(100, error("CheckInputs(): %s value in (%s) < value out (%s) diff %.8f", tx.GetHash().ToString(), FormatMoney(nValueIn), FormatMoney(tx.GetValueOut()),((double)nValueIn - tx.GetValueOut())/COIN),REJECT_INVALID, "bad-txns-in-belowout"); - + } // Tally transaction fees CAmount nTxFee = nValueIn - tx.GetValueOut(); if (nTxFee < 0) From 28ee65c78ae47296adc8a96cc9f422fcdf9a3f08 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 14:42:46 +0300 Subject: [PATCH 11/19] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 8c4d6abd6..af70ede77 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2012,7 +2012,7 @@ fprintf(stderr,"checkResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\ if (nValueIn < tx.GetValueOut()) { - fprintf(stderr,"valuein %s vs %s error\n",FormatMoney(nValueIn), FormatMoney(tx.GetValueOut())); + fprintf(stderr,"valuein %s vs %s error\n",FormatMoney(nValueIn).c_str(), FormatMoney(tx.GetValueOut()).c_str()); return state.DoS(100, error("CheckInputs(): %s value in (%s) < value out (%s) diff %.8f", tx.GetHash().ToString(), FormatMoney(nValueIn), FormatMoney(tx.GetValueOut()),((double)nValueIn - tx.GetValueOut())/COIN),REJECT_INVALID, "bad-txns-in-belowout"); } From c60397dd3a9615c17a3ae0d359569e2232efb8fb Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 15:38:49 +0300 Subject: [PATCH 12/19] Lagging chaintip fix --- src/coins.cpp | 4 ++-- src/komodo-tx.cpp | 2 +- src/komodo_bitcoind.h | 12 ++++++++---- src/main.cpp | 4 ++-- src/rpcblockchain.cpp | 4 ++-- src/wallet/rpcwallet.cpp | 4 ++-- src/wallet/wallet.cpp | 4 ++-- 7 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/coins.cpp b/src/coins.cpp index 0c527d9a0..bb40af9cc 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -387,7 +387,7 @@ const CScript &CCoinsViewCache::GetSpendFor(const CTxIn& input) const } //uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); -uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue); +uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight); extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTransaction& tx,uint32_t tiptime) const @@ -407,7 +407,7 @@ CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTr if ( value >= 10*COIN ) { int64_t interest; int32_t txheight; uint32_t locktime; - interest = komodo_accrued_interest(&txheight,&locktime,tx.vin[i].prevout.hash,tx.vin[i].prevout.n,0,value); + interest = komodo_accrued_interest(&txheight,&locktime,tx.vin[i].prevout.hash,tx.vin[i].prevout.n,0,value,(int32_t)nHeight); //printf("nResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nResult/COIN,(double)value/COIN,(double)interest/COIN,txheight,locktime,tiptime); //fprintf(stderr,"nResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nResult/COIN,(double)value/COIN,(double)interest/COIN,txheight,locktime,tiptime); nResult += interest; diff --git a/src/komodo-tx.cpp b/src/komodo-tx.cpp index 504296044..da2a9ec2e 100644 --- a/src/komodo-tx.cpp +++ b/src/komodo-tx.cpp @@ -32,7 +32,7 @@ using namespace std; #include "komodo_interest.h" -uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue) +uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight) { return(0); } diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index d7a467b44..bc61bc268 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -903,12 +903,13 @@ uint32_t komodo_interest_args(uint32_t *txheighttimep,int32_t *txheightp,uint32_ uint32_t locktime = 0; if ( n < tx.vout.size() ) { - if ( (pindex= mapBlockIndex[hashBlock]) != 0 && (tipindex= chainActive.Tip()) != 0 ) + if ( (pindex= mapBlockIndex[hashBlock]) != 0 ) { *valuep = tx.vout[n].nValue; *txheightp = pindex->nHeight; *txheighttimep = pindex->nTime; - *tiptimep = tipindex->nTime; + if ( *tiptimep == 0 && (tipindex= chainActive.Tip()) != 0 ) + *tiptimep = (uint32_t)tipindex->nTime; locktime = tx.nLockTime; //fprintf(stderr,"tx locktime.%u %.8f height.%d | tiptime.%u\n",locktime,(double)*valuep/COIN,*txheightp,*tiptimep); } @@ -917,9 +918,12 @@ uint32_t komodo_interest_args(uint32_t *txheighttimep,int32_t *txheightp,uint32_ } uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); -uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue) + +uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight) { - uint64_t value; uint32_t tiptime,txheighttimep; + uint64_t value; uint32_t tiptime=0,txheighttimep; CBlockIndex *pindex; + if ( (pindex= chainActive[tipheight]) != 0 ) + tiptime = (uint32_t)pindex->nTime; if ( (*locktimep= komodo_interest_args(&txheighttimep,txheightp,&tiptime,&value,hash,n)) != 0 ) { if ( (checkvalue == 0 || value == checkvalue) && (checkheight == 0 || *txheightp == checkheight) ) diff --git a/src/main.cpp b/src/main.cpp index af70ede77..fa62bdf38 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1986,12 +1986,12 @@ bool CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoins // Check for negative or overflow input values nValueIn += coins->vout[prevout.n].nValue; #ifdef KOMODO_ENABLE_INTEREST - if ( ASSETCHAINS_SYMBOL[0] == 0 && chainActive.Tip() != 0 && chainActive.Tip()->nHeight >= 60000 ) + if ( ASSETCHAINS_SYMBOL[0] == 0 && nSpendHeight > 60000 )//chainActive.Tip() != 0 && chainActive.Tip()->nHeight >= 60000 ) { if ( coins->vout[prevout.n].nValue >= 10*COIN ) { int64_t interest; int32_t txheight; uint32_t locktime; - if ( (interest= komodo_accrued_interest(&txheight,&locktime,prevout.hash,prevout.n,0,coins->vout[prevout.n].nValue)) != 0 ) + if ( (interest= komodo_accrued_interest(&txheight,&locktime,prevout.hash,prevout.n,0,coins->vout[prevout.n].nValue,(int32_t)nSpendHeight-1)) != 0 ) { fprintf(stderr,"checkResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nValueIn/COIN,(double)coins->vout[prevout.n].nValue/COIN,(double)interest/COIN,txheight,locktime,chainActive.Tip()->nTime); nValueIn += interest; diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index eef2ab8bf..bb67c7b4d 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -843,7 +843,7 @@ UniValue paxprices(const UniValue& params, bool fHelp) return ret; } -uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue); +uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight); UniValue gettxout(const UniValue& params, bool fHelp) { @@ -916,7 +916,7 @@ UniValue gettxout(const UniValue& params, bool fHelp) else ret.push_back(Pair("confirmations", pindex->nHeight - coins.nHeight + 1)); ret.push_back(Pair("value", ValueFromAmount(coins.vout[n].nValue))); uint64_t interest; int32_t txheight; uint32_t locktime; - if ( (interest= komodo_accrued_interest(&txheight,&locktime,hash,n,coins.nHeight,coins.vout[n].nValue)) != 0 ) + if ( (interest= komodo_accrued_interest(&txheight,&locktime,hash,n,coins.nHeight,coins.vout[n].nValue,(int32_t)pindex->nHeight)) != 0 ) ret.push_back(Pair("interest", ValueFromAmount(interest))); UniValue o(UniValue::VOBJ); ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o, true); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index bb5869a34..27e94134d 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -75,7 +75,7 @@ void EnsureWalletIsUnlocked() throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first."); } -uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue); +uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight); uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry) @@ -2675,9 +2675,9 @@ UniValue listunspent(const UniValue& params, bool fHelp) BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock()); CBlockIndex *tipindex,*pindex = it->second; uint64_t interest; uint32_t locktime; int32_t txheight; - komodo_accrued_interest(&txheight,&locktime,out.tx->GetHash(),out.i,0,nValue); if ( pindex != 0 && (tipindex= chainActive.Tip()) != 0 ) { + komodo_accrued_interest(&txheight,&locktime,out.tx->GetHash(),out.i,0,nValue,(int32_t)tipindex->nHeight); interest = komodo_interest(txheight,nValue,out.tx->nLockTime,tipindex->nTime); entry.push_back(Pair("interest",ValueFromAmount(interest))); } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 4b2262851..8172c00e3 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2247,7 +2247,7 @@ CAmount CWallet::GetImmatureWatchOnlyBalance() const * populate vCoins with vector of available COutputs. */ uint64_t komodo_interestnew(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); -uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue); +uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight); void CWallet::AvailableCoins(vector& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl, bool fIncludeZeroValue, bool fIncludeCoinBase) const { @@ -2291,9 +2291,9 @@ void CWallet::AvailableCoins(vector& vCoins, bool fOnlyConfirmed, const { if ( pcoin->vout[i].nValue >= 10*COIN ) { - komodo_accrued_interest(&txheight,&locktime,wtxid,i,0,pcoin->vout[i].nValue); if ( (tipindex= chainActive.Tip()) != 0 ) { + komodo_accrued_interest(&txheight,&locktime,wtxid,i,0,pcoin->vout[i].nValue,(int32_t)tipindex->nHeight); interest = komodo_interestnew(txheight,pcoin->vout[i].nValue,locktime,tipindex->nTime); } else interest = 0; //interest = komodo_interestnew(chainActive.Tip()->nHeight+1,pcoin->vout[i].nValue,pcoin->nLockTime,chainActive.Tip()->nTime); From 8b53992182b73330e52044ea998e8ef5f2700e6c Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 15:45:00 +0300 Subject: [PATCH 13/19] Test --- src/komodo_bitcoind.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index bc61bc268..d79765e5c 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -924,6 +924,7 @@ uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 uint64_t value; uint32_t tiptime=0,txheighttimep; CBlockIndex *pindex; if ( (pindex= chainActive[tipheight]) != 0 ) tiptime = (uint32_t)pindex->nTime; + else printf("cant find height[%d]\n",tipheight); if ( (*locktimep= komodo_interest_args(&txheighttimep,txheightp,&tiptime,&value,hash,n)) != 0 ) { if ( (checkvalue == 0 || value == checkvalue) && (checkheight == 0 || *txheightp == checkheight) ) From 72070c9477017320019edda2581c1a1d3527c7eb Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 15:55:54 +0300 Subject: [PATCH 14/19] Test --- src/komodo_bitcoind.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index d79765e5c..34575f35d 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -923,8 +923,11 @@ uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 { uint64_t value; uint32_t tiptime=0,txheighttimep; CBlockIndex *pindex; if ( (pindex= chainActive[tipheight]) != 0 ) + { tiptime = (uint32_t)pindex->nTime; - else printf("cant find height[%d]\n",tipheight); + fprintf(stderr,"tipheight.%d -> %u\n",tipheight,tiptime); + } + else fprintf(stderr,"cant find height[%d]\n",tipheight); if ( (*locktimep= komodo_interest_args(&txheighttimep,txheightp,&tiptime,&value,hash,n)) != 0 ) { if ( (checkvalue == 0 || value == checkvalue) && (checkheight == 0 || *txheightp == checkheight) ) From 2da1debd06b5ece46f730ed9315734c40bd2f36f Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 16:10:12 +0300 Subject: [PATCH 15/19] Test --- src/komodo_bitcoind.h | 3 --- src/main.cpp | 7 ++++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 34575f35d..3c7003a70 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -923,10 +923,7 @@ uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 { uint64_t value; uint32_t tiptime=0,txheighttimep; CBlockIndex *pindex; if ( (pindex= chainActive[tipheight]) != 0 ) - { tiptime = (uint32_t)pindex->nTime; - fprintf(stderr,"tipheight.%d -> %u\n",tipheight,tiptime); - } else fprintf(stderr,"cant find height[%d]\n",tipheight); if ( (*locktimep= komodo_interest_args(&txheighttimep,txheightp,&tiptime,&value,hash,n)) != 0 ) { diff --git a/src/main.cpp b/src/main.cpp index fa62bdf38..45cf3116e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1993,7 +1993,7 @@ bool CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoins int64_t interest; int32_t txheight; uint32_t locktime; if ( (interest= komodo_accrued_interest(&txheight,&locktime,prevout.hash,prevout.n,0,coins->vout[prevout.n].nValue,(int32_t)nSpendHeight-1)) != 0 ) { -fprintf(stderr,"checkResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nValueIn/COIN,(double)coins->vout[prevout.n].nValue/COIN,(double)interest/COIN,txheight,locktime,chainActive.Tip()->nTime); +//fprintf(stderr,"checkResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nValueIn/COIN,(double)coins->vout[prevout.n].nValue/COIN,(double)interest/COIN,txheight,locktime,chainActive.Tip()->nTime); nValueIn += interest; } } @@ -2012,8 +2012,9 @@ fprintf(stderr,"checkResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\ if (nValueIn < tx.GetValueOut()) { - fprintf(stderr,"valuein %s vs %s error\n",FormatMoney(nValueIn).c_str(), FormatMoney(tx.GetValueOut()).c_str()); - return state.DoS(100, error("CheckInputs(): %s value in (%s) < value out (%s) diff %.8f", + fprintf(stderr,"spentheight.%d valuein %s vs %s error\n",nSpendHeight,FormatMoney(nValueIn).c_str(), FormatMoney(tx.GetValueOut()).c_str()); + if ( nSpendHeight > 300000 ) + return state.DoS(100, error("CheckInputs(): %s value in (%s) < value out (%s) diff %.8f", tx.GetHash().ToString(), FormatMoney(nValueIn), FormatMoney(tx.GetValueOut()),((double)nValueIn - tx.GetValueOut())/COIN),REJECT_INVALID, "bad-txns-in-belowout"); } // Tally transaction fees From b3167f313c080f5becfe1e5c34800ff984f9edf7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 16:15:14 +0300 Subject: [PATCH 16/19] Test --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 45cf3116e..e99a73d76 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2019,11 +2019,11 @@ bool CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoins } // Tally transaction fees CAmount nTxFee = nValueIn - tx.GetValueOut(); - if (nTxFee < 0) + if (nTxFee < 0 && nSpendHeight > 300000 ) return state.DoS(100, error("CheckInputs(): %s nTxFee < 0", tx.GetHash().ToString()), REJECT_INVALID, "bad-txns-fee-negative"); nFees += nTxFee; - if (!MoneyRange(nFees)) + if (!MoneyRange(nFees) && nSpendHeight > 300000 ) return state.DoS(100, error("CheckInputs(): nFees out of range"), REJECT_INVALID, "bad-txns-fee-outofrange"); return true; From f03351d46f30b9908b1df2585bff5fa20502d2c4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 16:22:37 +0300 Subject: [PATCH 17/19] 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 3c7003a70..5c41783b4 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -716,7 +716,7 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height) if ( komodo_blockload(block,pindex) == 0 ) { komodo_block2pubkey33(pubkey33,block); - if ( pubkey33[0] == 2 || pubkey33[0] == 3 ) + if ( 0 && (pubkey33[0] == 2 || pubkey33[0] == 3) ) { memcpy(pindex->pubkey33,pubkey33,33); if ( (num= komodo_notaries(pubkeys,(int32_t)pindex->nHeight,(uint32_t)pindex->nTime)) > 0 ) From 2c0218f0abaf425af694aab3c56677dee2b2f5a7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 16:23:01 +0300 Subject: [PATCH 18/19] Test --- src/main.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index e99a73d76..151c42383 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2013,17 +2013,16 @@ bool CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoins if (nValueIn < tx.GetValueOut()) { fprintf(stderr,"spentheight.%d valuein %s vs %s error\n",nSpendHeight,FormatMoney(nValueIn).c_str(), FormatMoney(tx.GetValueOut()).c_str()); - if ( nSpendHeight > 300000 ) - return state.DoS(100, error("CheckInputs(): %s value in (%s) < value out (%s) diff %.8f", + return state.DoS(100, error("CheckInputs(): %s value in (%s) < value out (%s) diff %.8f", tx.GetHash().ToString(), FormatMoney(nValueIn), FormatMoney(tx.GetValueOut()),((double)nValueIn - tx.GetValueOut())/COIN),REJECT_INVALID, "bad-txns-in-belowout"); } // Tally transaction fees CAmount nTxFee = nValueIn - tx.GetValueOut(); - if (nTxFee < 0 && nSpendHeight > 300000 ) + if (nTxFee < 0) return state.DoS(100, error("CheckInputs(): %s nTxFee < 0", tx.GetHash().ToString()), REJECT_INVALID, "bad-txns-fee-negative"); nFees += nTxFee; - if (!MoneyRange(nFees) && nSpendHeight > 300000 ) + if (!MoneyRange(nFees)) return state.DoS(100, error("CheckInputs(): nFees out of range"), REJECT_INVALID, "bad-txns-fee-outofrange"); return true; From 487f2319cd1d38f2f8a7e04021325c3059f5ac4f Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Mar 2018 18:17:21 +0300 Subject: [PATCH 19/19] Try again --- src/komodo_bitcoind.h | 13 +++++++------ src/miner.cpp | 7 ------- src/pow.cpp | 1 - src/rpcblockchain.cpp | 2 +- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 5c41783b4..0c905e785 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -716,7 +716,7 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height) if ( komodo_blockload(block,pindex) == 0 ) { komodo_block2pubkey33(pubkey33,block); - if ( 0 && (pubkey33[0] == 2 || pubkey33[0] == 3) ) + if ( (pubkey33[0] == 2 || pubkey33[0] == 3) ) { memcpy(pindex->pubkey33,pubkey33,33); if ( (num= komodo_notaries(pubkeys,(int32_t)pindex->nHeight,(uint32_t)pindex->nTime)) > 0 ) @@ -754,7 +754,7 @@ int8_t komodo_minerid(int32_t height,uint8_t *pubkey33) int32_t num,i,numnotaries; CBlockIndex *pindex; uint32_t timestamp=0; uint8_t _pubkey33[33],pubkeys[64][33]; if ( (pindex= chainActive[height]) != 0 ) { - if ( pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3 ) + if ( (pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3) ) { if ( pubkey33 != 0 ) memcpy(pubkey33,pindex->pubkey33,33); @@ -806,16 +806,17 @@ int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *non else return(0); } -int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width) +int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width) // deprecate { - int32_t i,n=0; + /*int32_t i,n=0; for (i=0; i 0 ) fprintf(stderr,"ht.%d notaryid.%d already mined -i.%d nid.%d\n",height,notaryid,i,nid); diff --git a/src/miner.cpp b/src/miner.cpp index e820c42e5..9a8eb59a5 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -523,7 +523,6 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& // // Internal miner // -int8_t komodo_minerid(int32_t height,uint8_t *pubkey33); CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) { @@ -776,12 +775,6 @@ void static BitcoinMiner() break; if ( externalflag == 0 && i != 66 ) printf("VIOLATION at %d\n",i); - for (i=0; i<66; i++) - { break; - for (j=0; j<33; j++) - printf("%02x",pubkeys[i][j]); - printf(" p%d -> %d\n",i,komodo_minerid(pindexPrev->nHeight-i,pubkeys[i])); - } for (j=gpucount=0; j<65; j++) { if ( mids[j] >= 0 || notaryid == 34 ) diff --git a/src/pow.cpp b/src/pow.cpp index 4765699d4..76960933d 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -120,7 +120,6 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33, int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp); int32_t komodo_currentheight(); CBlockIndex *komodo_chainactive(int32_t height); -//int8_t komodo_minerid(int32_t height,uint8_t *pubkey33); void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height); extern int32_t KOMODO_CHOSEN_ONE; extern char ASSETCHAINS_SYMBOL[]; diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index bb67c7b4d..1254217ac 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -636,7 +636,7 @@ UniValue minerids(const UniValue& params, bool fHelp) if ( pblockindex != 0 ) timestamp = pblockindex->GetBlockTime(); } - if ( (n= komodo_minerids(minerids,height,(int32_t)(sizeof(minerids)/sizeof(*minerids)))) > 0 ) + if ( 0 && (n= komodo_minerids(minerids,height,(int32_t)(sizeof(minerids)/sizeof(*minerids)))) > 0 ) { memset(tally,0,sizeof(tally)); numnotaries = komodo_notaries(pubkeys,height,timestamp);