1 /******************************************************************************
2 * Copyright © 2014-2018 The SuperNET Developers. *
4 * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
5 * the top-level directory of this distribution for the individual copyright *
6 * holder information and the developer policies on copyright and licensing. *
8 * Unless otherwise agreed in a custom licensing agreement, no part of the *
9 * SuperNET software, including this file may be copied, modified, propagated *
10 * or distributed except according to the terms contained in the LICENSE file *
12 * Removal or modification of this copyright notice is prohibited. *
14 ******************************************************************************/
16 #include "komodo_defs.h"
18 void komodo_prefetch(FILE *fp);
19 uint32_t komodo_heightstamp(int32_t height);
20 void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t kheight,uint32_t ktime,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth);
21 void komodo_init(int32_t height);
22 int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip);
23 int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp);
24 char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port);
25 void komodo_init(int32_t height);
26 int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp);
27 int32_t komodo_isrealtime(int32_t *kmdheightp);
28 uint64_t komodo_paxtotal();
29 int32_t komodo_longestchain();
30 uint64_t komodo_maxallowed(int32_t baseid);
31 int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max);
33 pthread_mutex_t komodo_mutex;
35 #define KOMODO_ELECTION_GAP 2000 //((ASSETCHAINS_SYMBOL[0] == 0) ? 2000 : 100)
36 #define IGUANA_MAXSCRIPTSIZE 10001
37 #define KOMODO_ASSETCHAIN_MAXLEN 65
39 struct pax_transaction *PAX;
40 int32_t NUM_PRICES; uint32_t *PVALS;
41 struct knotaries_entry *Pubkeys;
43 struct komodo_state KOMODO_STATES[34];
45 #define _COINBASE_MATURITY 100
46 int COINBASE_MATURITY = _COINBASE_MATURITY;//100;
48 int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND;
49 int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,JUMBLR_PAUSE = 1;
50 std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY;
51 uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE;
53 char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096];
54 uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
55 uint32_t ASSETCHAIN_INIT,ASSETCHAINS_CC,KOMODO_STOPAT;
56 uint32_t ASSETCHAINS_MAGIC = 2387029918;
57 uint64_t KOMODO_INTERESTSUM,KOMODO_WALLETBALANCE;
58 uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_DECAY,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED,ASSETCHAINS_SUPPLY = 10;
60 uint32_t KOMODO_INITDONE;
61 char KMDUSERPASS[8192],BTCUSERPASS[8192]; uint16_t KMD_PORT = 7771,BITCOIND_RPCPORT = 7771;
62 uint64_t PENDING_KOMODO_TX;
63 extern int32_t KOMODO_LOADINGBLOCKS;
64 unsigned int MAX_BLOCK_SIGOPS = 20000;
66 struct komodo_kv *KOMODO_KV;
67 pthread_mutex_t KOMODO_KV_mutex,KOMODO_CC_mutex;