From 7cfb6293c6b820426ed7184d4ee12c6cd8152d40 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 21 Jan 2019 00:31:14 -1100 Subject: [PATCH] komodo_defs a lot more --- src/cc/CCinclude.h | 5 ----- src/chainparams.cpp | 5 ----- src/komodo_bitcoind.h | 2 +- src/komodo_defs.h | 40 ++++++++++++++++++++++++++++++++++++++++ src/metrics.cpp | 3 +-- src/miner.cpp | 9 --------- src/pow.cpp | 5 ++--- src/primitives/block.cpp | 2 +- src/rpc/mining.cpp | 6 ++---- src/rpc/misc.cpp | 3 ++- src/wallet/rpcwallet.cpp | 3 +-- src/wallet/wallet.cpp | 6 ------ 12 files changed, 50 insertions(+), 39 deletions(-) diff --git a/src/cc/CCinclude.h b/src/cc/CCinclude.h index 1953fad34..66c001969 100644 --- a/src/cc/CCinclude.h +++ b/src/cc/CCinclude.h @@ -51,11 +51,6 @@ one other technical note is that komodod has the insight-explorer extensions bui #include "../utlist.h" #include "../uthash.h" -extern int32_t KOMODO_CONNECTING,KOMODO_CCACTIVATE,KOMODO_DEALERNODE; -extern uint32_t ASSETCHAINS_CC; -extern char ASSETCHAINS_SYMBOL[]; -extern std::string CCerror,ASSETCHAINS_CCLIB; -extern uint8_t ASSETCHAINS_CCDISABLES[256]; #define CC_MAXVINS 1024 diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 47f4d48a8..c7232761b 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -92,11 +92,6 @@ static CBlock CreateGenesisBlock(uint32_t nTime, const uint256& nNonce, const st void *chainparams_commandline(void *ptr); #include "komodo_defs.h" -extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; -extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; -extern uint32_t ASSETCHAIN_INIT, ASSETCHAINS_MAGIC; -extern int32_t VERUS_BLOCK_POSUNITS, ASSETCHAINS_LWMAPOS, ASSETCHAINS_SAPLING, ASSETCHAINS_OVERWINTER; -extern uint64_t ASSETCHAINS_SUPPLY, ASSETCHAINS_ALGO, ASSETCHAINS_EQUIHASH, ASSETCHAINS_VERUSHASH; const arith_uint256 maxUint = UintToArith256(uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 5e1ec7f66..9d0ea3228 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1470,7 +1470,7 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_ else return(1); } txn_count = pblock->vtx.size(); - fprintf(stderr,"checkblock n.%d vins.%d vouts.%d\n",txn_count,pblock->vtx[txn_count-1].vin.size(),pblock->vtx[txn_count-1].vout.size()); + fprintf(stderr,"checkblock n.%d vins.%d vouts.%d %.8f %.8f\n",txn_count,pblock->vtx[txn_count-1].vin.size(),pblock->vtx[txn_count-1].vout.size(),(double)pblock->vtx[txn_count-1].vout[0].nValue/COIN,(doube)pblock->vtx[txn_count-1].vout[1].nValue/COIN); if ( txn_count > 1 && pblock->vtx[txn_count-1].vin.size() == 1 && pblock->vtx[txn_count-1].vout.size() == 1 + (ASSETCHAINS_MARMARA!=0) ) { it = mapBlockIndex.find(pblock->hashPrevBlock); diff --git a/src/komodo_defs.h b/src/komodo_defs.h index 91fcadddb..47916d5c4 100644 --- a/src/komodo_defs.h +++ b/src/komodo_defs.h @@ -36,5 +36,45 @@ extern uint8_t ASSETCHAINS_TXPOW,ASSETCHAINS_PUBLIC; int32_t MAX_BLOCK_SIZE(int32_t height); +extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; +extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; +extern uint32_t ASSETCHAIN_INIT, ASSETCHAINS_MAGIC; +extern int32_t VERUS_BLOCK_POSUNITS, ASSETCHAINS_LWMAPOS, ASSETCHAINS_SAPLING, ASSETCHAINS_OVERWINTER; +extern uint64_t ASSETCHAINS_SUPPLY; + +extern uint64_t ASSETCHAINS_TIMELOCKGTE; +extern uint32_t ASSETCHAINS_ALGO, ASSETCHAINS_VERUSHASH,ASSETCHAINS_EQUIHASH; + +extern int32_t KOMODO_MININGTHREADS,KOMODO_LONGESTCHAIN,ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE; +extern uint64_t ASSETCHAINS_COMMISSION, ASSETCHAINS_STAKED; +extern bool VERUS_MINTBLOCKS; +extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_TIMELOCKGTE, ASSETCHAINS_NONCEMASK[]; +extern const char *ASSETCHAINS_ALGORITHMS[]; +extern int32_t VERUS_MIN_STAKEAGE, ASSETCHAINS_ALGO, ASSETCHAINS_EQUIHASH; +extern uint32_t ASSETCHAINS_VERUSHASH, ASSETCHAINS_LASTERA, ASSETCHAINS_LWMAPOS, ASSETCHAINS_NONCESHIFT[], ASSETCHAINS_HASHESPERROUND[]; +extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; +extern std::string NOTARY_PUBKEY,ASSETCHAINS_OVERRIDE_PUBKEY,ASSETCHAINS_SCRIPTPUB; +extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_MARMARA; + +extern uint32_t ASSETCHAINS_ALGO, ASSETCHAINS_EQUIHASH, ASSETCHAINS_STAKED; +extern char ASSETCHAINS_SYMBOL[65]; +extern int32_t ASSETCHAINS_LWMAPOS,VERUS_BLOCK_POSUNITS, VERUS_CONSECUTIVE_POS_THRESHOLD, VERUS_NOPOS_THRESHHOLD; + +extern int32_t ASSETCHAINS_EQUIHASH, ASSETCHAINS_LWMAPOS; + +extern int32_t KOMODO_CONNECTING,KOMODO_CCACTIVATE,KOMODO_DEALERNODE; +extern uint32_t ASSETCHAINS_CC; +extern char ASSETCHAINS_SYMBOL[]; +extern std::string CCerror,ASSETCHAINS_CCLIB; +extern uint8_t ASSETCHAINS_CCDISABLES[256]; + +extern int32_t USE_EXTERNAL_PUBKEY; +extern std::string NOTARY_PUBKEY; +extern int32_t KOMODO_EXCHANGEWALLET; +extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; +extern int32_t VERUS_MIN_STAKEAGE; +extern std::string DONATION_PUBKEY; +extern uint8_t ASSETCHAINS_PRIVATE; +extern int32_t USE_EXTERNAL_PUBKEY; #endif diff --git a/src/metrics.cpp b/src/metrics.cpp index a01d381a1..6b387f7dc 100644 --- a/src/metrics.cpp +++ b/src/metrics.cpp @@ -39,8 +39,7 @@ #endif #include -extern uint64_t ASSETCHAINS_TIMELOCKGTE; -extern uint32_t ASSETCHAINS_ALGO, ASSETCHAINS_VERUSHASH; +#include "komodo_defs.h" int64_t komodo_block_unlocktime(uint32_t nHeight); void AtomicTimer::start() diff --git a/src/miner.cpp b/src/miner.cpp index f8fb8ba5f..78eb84e7b 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -132,17 +132,8 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, #include "komodo_defs.h" extern CCriticalSection cs_metrics; -extern int32_t KOMODO_MININGTHREADS,KOMODO_LONGESTCHAIN,ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE; -extern uint64_t ASSETCHAINS_COMMISSION, ASSETCHAINS_STAKED; -extern bool VERUS_MINTBLOCKS; -extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_TIMELOCKGTE, ASSETCHAINS_NONCEMASK[]; -extern const char *ASSETCHAINS_ALGORITHMS[]; -extern int32_t VERUS_MIN_STAKEAGE, ASSETCHAINS_ALGO, ASSETCHAINS_EQUIHASH, ASSETCHAINS_VERUSHASH, ASSETCHAINS_LASTERA, ASSETCHAINS_LWMAPOS, ASSETCHAINS_NONCESHIFT[], ASSETCHAINS_HASHESPERROUND[]; -extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; -extern std::string NOTARY_PUBKEY,ASSETCHAINS_OVERRIDE_PUBKEY,ASSETCHAINS_SCRIPTPUB; void vcalc_sha256(char deprecated[(256 >> 3) * 2 + 1],uint8_t hash[256 >> 3],uint8_t *src,int32_t len); -extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_MARMARA; uint32_t Mining_start,Mining_height; int32_t My_notaryid = -1; int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp); diff --git a/src/pow.cpp b/src/pow.cpp index b69c4fce6..cc2b0b7c2 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -37,9 +37,8 @@ #endif // ENABLE_RUST uint32_t komodo_chainactive_timestamp(); -extern uint32_t ASSETCHAINS_ALGO, ASSETCHAINS_EQUIHASH, ASSETCHAINS_STAKED; -extern char ASSETCHAINS_SYMBOL[65]; -extern int32_t ASSETCHAINS_LWMAPOS,VERUS_BLOCK_POSUNITS, VERUS_CONSECUTIVE_POS_THRESHOLD, VERUS_NOPOS_THRESHHOLD; +#include "komodo_defs.h" + unsigned int lwmaGetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params); unsigned int lwmaCalculateNextWorkRequired(const CBlockIndex* pindexLast, const Consensus::Params& params); diff --git a/src/primitives/block.cpp b/src/primitives/block.cpp index 00fc8cee9..bb3314760 100644 --- a/src/primitives/block.cpp +++ b/src/primitives/block.cpp @@ -24,8 +24,8 @@ #include "tinyformat.h" #include "utilstrencodings.h" #include "crypto/common.h" +#include "komodo_defs.h" -extern uint32_t ASSETCHAINS_ALGO, ASSETCHAINS_VERUSHASH; // default hash algorithm for block uint256 (CBlockHeader::*CBlockHeader::hashFunction)() const = &CBlockHeader::GetSHA256DHash; diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index a0643528d..ff9b1b4c4 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -48,10 +48,8 @@ using namespace std; -extern int32_t ASSETCHAINS_ALGO, ASSETCHAINS_EQUIHASH, ASSETCHAINS_LWMAPOS; -extern uint64_t ASSETCHAINS_STAKED; -extern int32_t KOMODO_MININGTHREADS; -extern bool VERUS_MINTBLOCKS; +#include "komodo_defs.h" + arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc); /** diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 0ebfa7b25..2491055d1 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -77,7 +77,8 @@ int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heig extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; extern uint32_t ASSETCHAINS_CC; extern uint32_t ASSETCHAINS_MAGIC; -extern uint64_t ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED,ASSETCHAINS_SUPPLY,ASSETCHAINS_LASTERA; +extern uint64_t ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED,ASSETCHAINS_SUPPLY; +extern uint32_t ASSETCHAINS_LASTERA; extern int32_t ASSETCHAINS_LWMAPOS,ASSETCHAINS_SAPLING; extern uint64_t ASSETCHAINS_ENDSUBSIDY[],ASSETCHAINS_REWARD[],ASSETCHAINS_HALVING[],ASSETCHAINS_DECAY[]; extern std::string NOTARY_PUBKEY; extern uint8_t NOTARY_PUBKEY33[]; diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 174f447f0..3acee9c1f 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -57,6 +57,7 @@ #include +#include "komodo_defs.h" using namespace std; @@ -67,8 +68,6 @@ const std::string ADDR_TYPE_SPROUT = "sprout"; const std::string ADDR_TYPE_SAPLING = "sapling"; extern UniValue TxJoinSplitToJSON(const CTransaction& tx); -extern uint8_t ASSETCHAINS_PRIVATE; -extern int32_t USE_EXTERNAL_PUBKEY; uint32_t komodo_segid32(char *coinaddr); int32_t komodo_dpowconfs(int32_t height,int32_t numconfs); int32_t komodo_isnotaryvout(char *coinaddr); // from ac_private chains only diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 0000f8d42..d171812c4 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -59,13 +59,7 @@ bool fSendFreeTransactions = false; bool fPayAtLeastCustomFee = true; #include "komodo_defs.h" -extern int32_t USE_EXTERNAL_PUBKEY; -extern std::string NOTARY_PUBKEY; -extern int32_t KOMODO_EXCHANGEWALLET; -extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; -extern int32_t VERUS_MIN_STAKEAGE; CBlockIndex *komodo_chainactive(int32_t height); -extern std::string DONATION_PUBKEY; /** * Fees smaller than this (in satoshi) are considered zero fee (for transaction creation)