]>
Commit | Line | Data |
---|---|---|
3face669 | 1 | /****************************************************************************** |
713c2a94 | 2 | * Copyright © 2014-2018 The SuperNET Developers. * |
3face669 | 3 | * * |
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. * | |
7 | * * | |
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 * | |
11 | * * | |
12 | * Removal or modification of this copyright notice is prohibited. * | |
13 | * * | |
14 | ******************************************************************************/ | |
15 | ||
5416af1d | 16 | #include "komodo_defs.h" |
17 | ||
5fb74817 | 18 | #include "uthash.h" |
19 | #include "utlist.h" | |
20 | ||
9cb1ec9c | 21 | /*#ifdef _WIN32 |
ab918767 | 22 | #define PACKED |
23 | #else | |
24 | #define PACKED __attribute__((packed)) | |
d3d31824 | 25 | #endif*/ |
ab918767 | 26 | |
07f83521 SS |
27 | #ifndef KOMODO_STRUCTS_H |
28 | #define KOMODO_STRUCTS_H | |
29 | ||
45a3a2ff | 30 | #define GENESIS_NBITS 0x1f00ffff |
aa114a60 | 31 | #define KOMODO_MINRATIFY ((height < 90000) ? 7 : 11) |
8683bd8d | 32 | #define KOMODO_NOTARIES_HARDCODED 180000 // DONT CHANGE |
33 | #define KOMODO_MAXBLOCKS 250000 // DONT CHANGE | |
45a3a2ff | 34 | |
ab918767 | 35 | #define KOMODO_EVENT_RATIFY 'P' |
36 | #define KOMODO_EVENT_NOTARIZED 'N' | |
37 | #define KOMODO_EVENT_KMDHEIGHT 'K' | |
38 | #define KOMODO_EVENT_REWIND 'B' | |
39 | #define KOMODO_EVENT_PRICEFEED 'V' | |
40 | #define KOMODO_EVENT_OPRETURN 'R' | |
41 | #define KOMODO_OPRETURN_DEPOSIT 'D' | |
42 | #define KOMODO_OPRETURN_ISSUED 'I' // assetchain | |
43 | #define KOMODO_OPRETURN_WITHDRAW 'W' // assetchain | |
44 | #define KOMODO_OPRETURN_REDEEMED 'X' | |
45 | ||
64449ba8 | 46 | #define KOMODO_KVPROTECTED 1 |
47 | #define KOMODO_KVBINARY 2 | |
48 | #define KOMODO_KVDURATION 1440 | |
cc30b05e | 49 | #define KOMODO_ASSETCHAIN_MAXLEN 65 |
64449ba8 | 50 | |
6b5cfbb4 | 51 | union _bits320 { uint8_t bytes[40]; uint16_t ushorts[20]; uint32_t uints[10]; uint64_t ulongs[5]; uint64_t txid; }; |
52 | typedef union _bits320 bits320; | |
53 | ||
54 | struct komodo_kv { UT_hash_handle hh; bits256 pubkey; uint8_t *key,*value; int32_t height; uint32_t flags; uint16_t keylen,valuesize; }; | |
15d0fbd4 | 55 | |
ed7bd562 | 56 | struct komodo_event_notarized { uint256 blockhash,desttxid,MoM; int32_t notarizedheight,MoMdepth; char dest[16]; }; |
ab918767 | 57 | struct komodo_event_pubkeys { uint8_t num; uint8_t pubkeys[64][33]; }; |
58 | struct komodo_event_opreturn { uint256 txid; uint64_t value; uint16_t vout,oplen; uint8_t opret[]; }; | |
59 | struct komodo_event_pricefeed { uint8_t num; uint32_t prices[35]; }; | |
60 | ||
61 | struct komodo_event | |
62 | { | |
63 | struct komodo_event *related; | |
64 | uint16_t len; | |
65 | int32_t height; | |
66 | uint8_t type,reorged; | |
7c130297 | 67 | char symbol[KOMODO_ASSETCHAIN_MAXLEN]; |
ab918767 | 68 | uint8_t space[]; |
d3d31824 | 69 | }; |
ab918767 | 70 | |
3face669 | 71 | struct pax_transaction |
72 | { | |
73 | UT_hash_handle hh; | |
74 | uint256 txid; | |
992c3be5 | 75 | uint64_t komodoshis,fiatoshis,validated; |
115e6a5c | 76 | int32_t marked,height,otherheight,approved,didstats,ready; |
3face669 | 77 | uint16_t vout; |
7c130297 | 78 | char symbol[KOMODO_ASSETCHAIN_MAXLEN],source[KOMODO_ASSETCHAIN_MAXLEN],coinaddr[64]; uint8_t rmd160[20],type,buf[35]; |
3face669 | 79 | }; |
80 | ||
3face669 | 81 | struct knotary_entry { UT_hash_handle hh; uint8_t pubkey[33],notaryid; }; |
82 | struct knotaries_entry { int32_t height,numnotaries; struct knotary_entry *Notaries; }; | |
18c6cfce | 83 | struct notarized_checkpoint |
84 | { | |
51dab149 | 85 | uint256 notarized_hash,notarized_desttxid,MoM,MoMoM; |
86 | int32_t nHeight,notarized_height,MoMdepth,MoMoMdepth,MoMoMoffset,kmdstarti,kmdendi; | |
18c6cfce | 87 | }; |
d1289e41 | 88 | |
d269d79e | 89 | struct komodo_ccdataMoM |
90 | { | |
91 | uint256 MoM; | |
623d2eff | 92 | int32_t MoMdepth,notarized_height,height,txi; |
d269d79e | 93 | }; |
00c6ec9d | 94 | |
623d2eff | 95 | struct komodo_ccdata_entry { uint256 MoM; int32_t notarized_height,kmdheight,txi; char symbol[65]; }; |
5740b2aa | 96 | struct komodo_ccdatapair { int32_t notarized_height,MoMoMoffset; }; |
00c6ec9d | 97 | |
d269d79e | 98 | struct komodo_ccdataMoMoM |
99 | { | |
100 | uint256 MoMoM; | |
1b491957 | 101 | int32_t kmdstarti,kmdendi,MoMoMoffset,MoMoMdepth,numpairs,len; |
d269d79e | 102 | struct komodo_ccdatapair *pairs; |
103 | }; | |
00c6ec9d | 104 | |
713c2a94 | 105 | struct komodo_ccdata |
106 | { | |
fb9c3652 | 107 | struct komodo_ccdata *next,*prev; |
d269d79e | 108 | struct komodo_ccdataMoM MoMdata; |
51dab149 | 109 | uint32_t CCid,len; |
713c2a94 | 110 | char symbol[65]; |
111 | }; | |
112 | ||
d1289e41 | 113 | struct komodo_state |
114 | { | |
18c6cfce | 115 | uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID,MoM; |
116 | int32_t SAVEDHEIGHT,CURRENT_HEIGHT,NOTARIZED_HEIGHT,MoMdepth; | |
f1db88ea | 117 | uint32_t SAVEDTIMESTAMP; |
aa114a60 | 118 | uint64_t deposited,issued,withdrawn,approved,redeemed,shorted; |
a0b9382c | 119 | struct notarized_checkpoint *NPOINTS; int32_t NUM_NPOINTS,last_NPOINTSi; |
ab918767 | 120 | struct komodo_event **Komodo_events; int32_t Komodo_numevents; |
635dd34d | 121 | uint32_t RTbufs[64][3]; uint64_t RTmask; |
d1289e41 | 122 | }; |
07f83521 SS |
123 | |
124 | #endif /* KOMODO_STRUCTS_H */ |