From e3495bf3e9dbd2d226fc4667bffd05e6163d323d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 26 Feb 2019 12:17:53 +0800 Subject: [PATCH] remove pointless things --- src/Makefile.am | 21 +++++++-------- src/assetchains.json | 61 ++++++++++++++++++------------------------- src/bitcoin-cli.cpp | 1 - src/cc/dice.cpp | 8 +++--- src/cc/utils.h | 1 - src/coins.h | 8 +++--- src/komodo_bitcoind.h | 8 +++--- src/komodo_utils.h | 12 ++++----- src/main.cpp | 45 ++++++++++++------------------- src/miner.cpp | 2 +- 10 files changed, 70 insertions(+), 97 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index c0a2a2e03..a10868135 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -123,9 +123,8 @@ TESTS = bin_PROGRAMS += komodod #endif -# komodo-tx if BUILD_BITCOIN_UTILS - bin_PROGRAMS += komodo-cli + bin_PROGRAMS += komodo-cli komodo-tx endif if ENABLE_WALLET bin_PROGRAMS += wallet-utility @@ -205,7 +204,7 @@ BITCOIN_CORE_H = \ mruset.h \ net.h \ netbase.h \ - notaries_staked.h \ + notaries_staked.h \ noui.h \ paymentdisclosure.h \ paymentdisclosuredb.h \ @@ -313,7 +312,7 @@ libbitcoin_server_a_SOURCES = \ chain.cpp \ checkpoints.cpp \ crosschain.cpp \ - crosschain_authority.cpp \ + crosschain_authority.cpp \ crypto/haraka.h \ crypto/haraka_portable.h \ crypto/verus_hash.h \ @@ -328,7 +327,7 @@ libbitcoin_server_a_SOURCES = \ metrics.h \ miner.cpp \ net.cpp \ - notaries_staked.cpp \ + notaries_staked.cpp \ noui.cpp \ notarisationdb.cpp \ paymentdisclosure.cpp \ @@ -620,8 +619,8 @@ komodo_cli_LDADD = \ $(EVENT_LIBS) \ $(LIBZCASH) \ $(LIBBITCOIN_CRYPTO) \ - $(LIBVERUS_CRYPTO) \ - $(LIBVERUS_PORTABLE_CRYPTO) \ + $(LIBVERUS_CRYPTO) \ + $(LIBVERUS_PORTABLE_CRYPTO) \ $(LIBZCASH_LIBS) if ENABLE_WALLET @@ -629,8 +628,8 @@ wallet_utility_LDADD = \ libbitcoin_wallet.a \ $(LIBBITCOIN_COMMON) \ $(LIBBITCOIN_CRYPTO) \ - $(LIBVERUS_CRYPTO) \ - $(LIBVERUS_PORTABLE_CRYPTO) \ + $(LIBVERUS_CRYPTO) \ + $(LIBVERUS_PORTABLE_CRYPTO) \ $(LIBSECP256K1) \ $(LIBBITCOIN_UTIL) \ $(BOOST_LIBS) \ @@ -639,7 +638,7 @@ wallet_utility_LDADD = \ $(LIBZCASH) \ $(LIBSNARK) \ $(LIBZCASH_LIBS)\ - $(LIBCRYPTOCONDITIONS) + $(LIBCRYPTOCONDITIONS) endif # zcash-tx binary # @@ -679,7 +678,7 @@ libzcash_a_SOURCES = \ zcash/Note.cpp \ zcash/prf.cpp \ zcash/util.cpp \ - zcash/zip32.cpp \ + zcash/zip32.cpp \ zcash/circuit/commitment.tcc \ zcash/circuit/gadget.tcc \ zcash/circuit/merkle.tcc \ diff --git a/src/assetchains.json b/src/assetchains.json index bd07f1fb1..91baf9829 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -136,51 +136,42 @@ "ac_reward": "100000000" }, { - "ac_name": "CFEKED", - "ac_supply": "1000", + "ac_name": "SEC", + "ac_supply": "1000000000", + "ac_cc": "333" + }, + { + "ac_name": "CCL", + "ac_supply": "200000000", "ac_end": "1", - "ac_reward": "1", - "ac_staked": "1", - "ac_cc": "102", + "ac_cc": "2", + "addressindex": "1", + "spentindex": "1", "addnode": [ - "195.201.137.5", - "195.201.20.230" + "142.93.136.89", + "195.201.22.89" ] }, { - "ac_name": "CFEKING", - "ac_supply": "1000", - "ac_end": "1", - "ac_reward": "1", - "ac_staked": "1", - "ac_cc": "102", + "ac_name": "PIRATE", + "ac_supply": "0", + "ac_reward": "25600000000", + "ac_halving": "77777", + "ac_private": "1", "addnode": [ - "195.201.137.5", - "195.201.20.230" + "136.243.102.225" ] }, { - "ac_name": "CFEKLF", - "ac_supply": "1000", - "ac_end": "1", - "ac_reward": "1", - "ac_staked": "1", - "ac_cc": "102", + "ac_name": "MGNX", + "ac_supply": "12465003", + "ac_staked": "90", + "ac_reward": "2000000000", + "ac_halving": "525960", + "ac_cc": "2", + "ac_end": "2629800", "addnode": [ - "195.201.137.5", - "195.201.20.230" - ] - }, - { - "ac_name": "CFEKMLT", - "ac_supply": "1000", - "ac_end": "1", - "ac_reward": "1", - "ac_staked": "1", - "ac_cc": "102", - "addnode": [ - "195.201.137.5", - "195.201.20.230" + "142.93.27.180" ] }, { diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 31d3b9e3e..544972586 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -25,7 +25,6 @@ #include "util.h" #include "utilstrencodings.h" - #include #include diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index afd1ff5ac..ab723790f 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1213,9 +1213,6 @@ int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbit } else { return(0); } - fprintf(stderr,"numentropy tx %d: %.8f\n",n,(double)totalinputs/COIN); - entropytxs = n; - return(totalinputs); } bool DicePlanExists(CScript &fundingPubKey,uint256 &fundingtxid,struct CCcontract_info *cp,uint64_t refsbits,CPubKey dicepk,int64_t &minbet,int64_t &maxbet,int64_t &maxodds,int64_t &timeoutblocks) @@ -1419,7 +1416,7 @@ std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet CScript fundingPubKey; CPubKey mypk,dicepk; uint64_t sbits,entropyval,entropyval2; int64_t funding,minbet,maxbet,maxodds,timeoutblocks; uint256 entropytxid,entropytxid2,entropy,hentropy; struct CCcontract_info *cp,C; if ( bet < 0 ) { - CCerror = "bet must be positive"; + CCerror = "Diceinit error in bet, is your transaction confirmed?"; return(""); } if ( odds < 2 || odds > 9999 ) @@ -1756,7 +1753,8 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx CScript fundingPubKey,scriptPubKey; CTransaction spenttx,betTx,entropyTx; uint256 hentropyproof,entropyused,hash,proof,txid,hashBlock,spenttxid,bettorentropy; CPubKey mypk,dicepk,fundingpk; struct CCcontract_info *cp,C; int32_t i,entropyvout,flag,win,num,loss,duplicate=0,result,iswin,vout,n=0; int64_t minbet,maxbet,maxodds,timeoutblocks,sum=0; uint64_t sbits,refsbits; char coinaddr[64]; std::string res; uint8_t funcid; if ( (cp= Diceinit(fundingPubKey,fundingtxid,&C,planstr,txfee,mypk,dicepk,refsbits,minbet,maxbet,maxodds,timeoutblocks)) == 0 ) { - CCerror = "Diceinit error in status"; + CCerror = "Diceinit error in status, is your transaction confirmed?"; + fprintf(stderr,"%s\n", CCerror.c_str() ); return(0.); } win = loss = 0; diff --git a/src/cc/utils.h b/src/cc/utils.h index fcbea7f5b..39bce0e95 100644 --- a/src/cc/utils.h +++ b/src/cc/utils.h @@ -20,7 +20,6 @@ #include "version.h" - /* * Serialisation boilerplate */ diff --git a/src/coins.h b/src/coins.h index 6cd5d9933..e0ea7d822 100644 --- a/src/coins.h +++ b/src/coins.h @@ -41,7 +41,7 @@ #include "zcash/IncrementalMerkleTree.hpp" //#include "veruslaunch.h" -/** +/** * Pruned version of CTransaction: only retains metadata and unspent transaction outputs * * Serialized format: @@ -443,7 +443,7 @@ public: class CCoinsViewCache; -/** +/** * A reference to a mutable cache entry. Encapsulating it allows us to run * cleanup code after the modification is finished, and keeping track of * concurrent modifications. @@ -503,7 +503,7 @@ protected: /** * Make mutable so that we can "fill the cache" even from Get-methods - * declared as "const". + * declared as "const". */ mutable uint256 hashBlock; mutable CCoinsMap cacheCoins; @@ -579,7 +579,7 @@ public: //! Calculate the size of the cache (in bytes) size_t DynamicMemoryUsage() const; - /** + /** * Amount of bitcoins coming in to a transaction * Note that lightweight clients may not know anything besides the hash of previous transactions, * so may not be able to calculate this. diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index a7dd2027c..f23fde7c1 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1536,7 +1536,7 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_uint256 bnTarget,arith_uint256 bhash) { CBlockIndex *previndex,*pindex; char voutaddr[64],destaddr[64]; uint256 txid; uint32_t txtime,prevtime=0; int32_t vout,PoSperc,txn_count,eligible=0,isPoS = 0,segid; uint64_t value; CTxDestination voutaddress; arith_uint256 POWTarget; - if ( ASSETCHAINS_STAKED == 100 && height <= 100 ) + if ( ASSETCHAINS_STAKED == 100 && height <= 10 ) return(1); BlockMap::const_iterator it = mapBlockIndex.find(pblock->GetHash()); pindex = it != mapBlockIndex.end() ? it->second : NULL; @@ -2194,10 +2194,10 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) } // Check min sigs. int8_t numSN = 0; uint8_t notarypubkeys[64][33] = {0}; - numSN = komodo_notaries(notarypubkeys, height, pblock->nTime) - if ( pblock->vtx[1].vin.size() < numSN/5) ) + numSN = komodo_notaries(notarypubkeys, height, pblock->nTime); + if ( pblock->vtx[1].vin.size() < numSN/5 ) { - fprintf(stderr, "ht.%i does not meet minsigs.%i sigs.%li\n",height,numSN/5),pblock->vtx[1].vin.size()); + fprintf(stderr, "ht.%i does not meet minsigs.%i sigs.%li\n",height,numSN/5,pblock->vtx[1].vin.size()); return(-1); } } diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 8d6395ac2..2fbb782ce 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1690,7 +1690,7 @@ void komodo_args(char *argv0) IS_KOMODO_NOTARY = 1; KOMODO_MININGTHREADS = 1; mapArgs ["-genproclimit"] = itostr(KOMODO_MININGTHREADS); - IS_STAKED_NOTARY = -1; + IS_STAKED_NOTARY = -1; fprintf(stderr,"running as notary.%d %s\n",i,Notaries_elected1[i][0]); break; } @@ -1723,7 +1723,7 @@ void komodo_args(char *argv0) { printf("KOMODO_REWIND %d\n",KOMODO_REWIND); } - if ( name.c_str()[0] != 0 ) + if ( name.c_str()[0] != 0 ) { std::string selectedAlgo = GetArg("-ac_algo", std::string(ASSETCHAINS_ALGORITHMS[0])); @@ -1897,10 +1897,10 @@ void komodo_args(char *argv0) ASSETCHAINS_COMMISSION = 53846154; // maps to 35% printf("ASSETCHAINS_COMMISSION defaulted to 35%% when founders reward active\n"); } - else - { - printf("ASSETCHAINS_FOUNDERS_REWARD set to %ld\n", ASSETCHAINS_FOUNDERS_REWARD); - } + else + { + printf("ASSETCHAINS_FOUNDERS_REWARD set to %ld\n", ASSETCHAINS_FOUNDERS_REWARD); + } /*else if ( ASSETCHAINS_SELFIMPORT.size() == 0 ) { //ASSETCHAINS_OVERRIDE_PUBKEY.clear(); diff --git a/src/main.cpp b/src/main.cpp index 6ad0e613d..ab3a97549 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,7 +19,6 @@ ******************************************************************************/ #include "main.h" -#include "notaries_staked.h" #include "sodium.h" #include "addrman.h" @@ -1267,35 +1266,23 @@ extern uint8_t NUM_NOTARIES; int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only { - if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 ) - { - if ( NOTARYADDRS[0][0] != 0 && NUM_NOTARIES != 0 ) - { - for (int32_t i=0; i<=NUM_NOTARIES; i++) - if ( strcmp(coinaddr,NOTARYADDRS[i]) == 0 ) - return(1); - } - } - else - { - static int32_t didinit; static char notaryaddrs[sizeof(Notaries_elected1)/sizeof(*Notaries_elected1) + 1][64]; - int32_t i; - if ( didinit == 0 ) - { - uint8_t pubkey33[33]; - for (i=0; i<=sizeof(Notaries_elected1)/sizeof(*Notaries_elected1); i++) - { - if ( i < sizeof(Notaries_elected1)/sizeof(*Notaries_elected1) ) - decode_hex(pubkey33,33,(char *)Notaries_elected1[i][1]); - else decode_hex(pubkey33,33,(char *)CRYPTO777_PUBSECPSTR); - pubkey2addr((char *)notaryaddrs[i],(uint8_t *)pubkey33); - } - didinit = 1; - } - for (i=0; i<=sizeof(Notaries_elected1)/sizeof(*Notaries_elected1); i++) - if ( strcmp(coinaddr,notaryaddrs[i]) == 0 ) - return(1); + static int32_t didinit; static char notaryaddrs[sizeof(Notaries_elected1)/sizeof(*Notaries_elected1) + 1][64]; + int32_t i; + if ( didinit == 0 ) + { + uint8_t pubkey33[33]; + for (i=0; i<=sizeof(Notaries_elected1)/sizeof(*Notaries_elected1); i++) + { + if ( i < sizeof(Notaries_elected1)/sizeof(*Notaries_elected1) ) + decode_hex(pubkey33,33,(char *)Notaries_elected1[i][1]); + else decode_hex(pubkey33,33,(char *)CRYPTO777_PUBSECPSTR); + pubkey2addr((char *)notaryaddrs[i],(uint8_t *)pubkey33); + } + didinit = 1; } + for (i=0; i<=sizeof(Notaries_elected1)/sizeof(*Notaries_elected1); i++) + if ( strcmp(coinaddr,notaryaddrs[i]) == 0 ) + return(1); return(0); } diff --git a/src/miner.cpp b/src/miner.cpp index 0f87a0643..09ce3fd1a 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -253,7 +253,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32 if ( ASSETCHAINS_NOTARY_PAY[0] != 0 ) { // Only use speical miner for notary pay chains. - numSN = komodo_notaries(notarypubkeys, nHeight, pblock->nTime) + numSN = komodo_notaries(notarypubkeys, nHeight, pblock->nTime); } CCoinsViewCache view(pcoinsTip);