]> Git Repo - VerusCoin.git/blob - src/komodo_structs.h
MoM support
[VerusCoin.git] / src / komodo_structs.h
1 /******************************************************************************
2  * Copyright © 2014-2017 The SuperNET Developers.                             *
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
16 #include "komodo_defs.h"
17
18 #include "uthash.h"
19 #include "utlist.h"
20
21 /*#ifdef _WIN32
22 #define PACKED
23 #else
24 #define PACKED __attribute__((packed))
25 #endif*/
26
27 #define GENESIS_NBITS 0x1f00ffff
28 #define KOMODO_MINRATIFY ((height < 90000) ? 7 : 11)
29 #define KOMODO_NOTARIES_HARDCODED 180000 // DONT CHANGE
30 #define KOMODO_MAXBLOCKS 250000 // DONT CHANGE
31
32 #define KOMODO_EVENT_RATIFY 'P'
33 #define KOMODO_EVENT_NOTARIZED 'N'
34 #define KOMODO_EVENT_KMDHEIGHT 'K'
35 #define KOMODO_EVENT_REWIND 'B'
36 #define KOMODO_EVENT_PRICEFEED 'V'
37 #define KOMODO_EVENT_OPRETURN 'R'
38 #define KOMODO_OPRETURN_DEPOSIT 'D'
39 #define KOMODO_OPRETURN_ISSUED 'I' // assetchain
40 #define KOMODO_OPRETURN_WITHDRAW 'W' // assetchain
41 #define KOMODO_OPRETURN_REDEEMED 'X'
42
43 #define KOMODO_KVPROTECTED 1
44 #define KOMODO_KVBINARY 2
45 #define KOMODO_KVDURATION 1440
46 #define KOMODO_ASSETCHAIN_MAXLEN 65
47
48 union _bits256 { uint8_t bytes[32]; uint16_t ushorts[16]; uint32_t uints[8]; uint64_t ulongs[4]; uint64_t txid; };
49 typedef union _bits256 bits256;
50
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; };
55
56 struct komodo_event_notarized { uint256 blockhash,desttxid; int32_t notarizedheight; char dest[16]; };
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;
67     char symbol[KOMODO_ASSETCHAIN_MAXLEN];
68     uint8_t space[];
69 };
70
71 struct pax_transaction
72 {
73     UT_hash_handle hh;
74     uint256 txid;
75     uint64_t komodoshis,fiatoshis,validated;
76     int32_t marked,height,otherheight,approved,didstats,ready;
77     uint16_t vout;
78     char symbol[KOMODO_ASSETCHAIN_MAXLEN],source[KOMODO_ASSETCHAIN_MAXLEN],coinaddr[64]; uint8_t rmd160[20],type,buf[35];
79 };
80
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; };
83 struct notarized_checkpoint
84 {
85     uint256 notarized_hash,notarized_desttxid,MoM;
86     int32_t nHeight,notarized_height,MoMdepth;
87 };
88
89 struct komodo_state
90 {
91     uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID,MoM;
92     int32_t SAVEDHEIGHT,CURRENT_HEIGHT,NOTARIZED_HEIGHT,MoMdepth;
93     uint32_t SAVEDTIMESTAMP;
94     uint64_t deposited,issued,withdrawn,approved,redeemed,shorted;
95     struct notarized_checkpoint *NPOINTS; int32_t NUM_NPOINTS,last_NPOINTSi;
96     struct komodo_event **Komodo_events; int32_t Komodo_numevents;
97     uint32_t RTbufs[64][3]; uint64_t RTmask;
98 };
This page took 0.029697 seconds and 4 git commands to generate.