You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
4.5 KiB

/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
* holder information and the developer policies on copyright and licensing. *
* *
* Unless otherwise agreed in a custom licensing agreement, no part of the *
* SuperNET software, including this file may be copied, modified, propagated *
* or distributed except according to the terms contained in the LICENSE file *
* *
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
#ifndef INCLUDE_DPOW_H
#define INCLUDE_DPOW_H
8 years ago
#define DPOW_FIRSTRATIFY 1000
8 years ago
#define DPOW_CHECKPOINTFREQ 10
8 years ago
#define DPOW_MINSIGS 7
#define DPOW_M(bp) ((bp)->minsigs) // (((bp)->numnotaries >> 1) + 1)
8 years ago
#define DPOW_MODIND(bp,offset) (((((bp)->height / DPOW_CHECKPOINTFREQ) % (bp)->numnotaries) + (offset)) % (bp)->numnotaries)
8 years ago
#define DPOW_VERSION 0x0404
8 years ago
#define DPOW_UTXOSIZE 10000
8 years ago
#define DPOW_MINOUTPUT 6000
#define DPOW_DURATION 300
#define DPOW_RATIFYDURATION (3600 * 24)
8 years ago
#define DPOW_ENTRIESCHANNEL ('e' | ('n' << 8) | ('t' << 16) | ('r' << 24))
#define DPOW_BTCENTRIESCHANNEL (~DPOW_ENTRIESCHANNEL)
8 years ago
#define DPOW_UTXOCHANNEL ('d' | ('P' << 8) | ('o' << 16) | ('W' << 24))
#define DPOW_SIGCHANNEL ('s' | ('i' << 8) | ('g' << 16) | ('s' << 24))
#define DPOW_SIGBTCCHANNEL (~DPOW_SIGCHANNEL)
#define DPOW_TXIDCHANNEL ('t' | ('x' << 8) | ('i' << 16) | ('d' << 24))
#define DPOW_BTCTXIDCHANNEL (~DPOW_TXIDCHANNEL)
#define DPOW_FIFOSIZE 64
#define DPOW_MAXTX 8192
8 years ago
#define DPOW_THIRDPARTY_CONFIRMS 0
8 years ago
#define DPOW_KOMODOCONFIRMS 3
#define DPOW_BTCCONFIRMS 1
#define DPOW_MAXRELAYS 64
8 years ago
struct dpow_coinentry
{
bits256 prev_hash;
uint8_t siglens[DPOW_MAXRELAYS],sigs[DPOW_MAXRELAYS][76];
int32_t prev_vout;
};
struct dpow_utxoentry
{
bits256 srchash,desthash,commit,hashmsg;
uint64_t recvmask,othermasks[DPOW_MAXRELAYS];
int32_t srcvout,destvout,height;
int8_t bestk; uint8_t pubkey[33];
};
8 years ago
struct dpow_entry
{
8 years ago
bits256 commit,beacon;
8 years ago
uint64_t masks[2][DPOW_MAXRELAYS],recvmask,othermask;
8 years ago
int32_t height;
8 years ago
int8_t bestk;
8 years ago
uint8_t pubkey[33];
struct dpow_coinentry src,dest;
8 years ago
};
struct dpow_sigentry
{
bits256 beacon;
uint64_t mask;
int32_t refcount;
8 years ago
uint8_t senderind,lastk,siglen,sig[76],senderpub[33];
8 years ago
};
struct komodo_notaries
{
struct basilisk_relay RELAYS[DPOW_MAXRELAYS];
int32_t NUMRELAYS,RELAYID;
};
struct dpow_hashheight { bits256 hash; int32_t height; };
8 years ago
struct dpow_checkpoint
{
struct dpow_hashheight blockhash,approved;
bits256 miner; uint32_t blocktime,timestamp;
};
8 years ago
struct dpow_block
{
8 years ago
bits256 hashmsg,desttxid,srctxid,beacon,commit;
8 years ago
struct iguana_info *srccoin,*destcoin; char *opret_symbol;
8 years ago
uint64_t destsigsmasks[DPOW_MAXRELAYS],srcsigsmasks[DPOW_MAXRELAYS];
uint64_t recvmask,bestmask;
8 years ago
struct dpow_entry notaries[DPOW_MAXRELAYS];
8 years ago
uint32_t state,timestamp,waiting,sigcrcs[2],txidcrcs[2],utxocrcs[2];
8 years ago
int32_t height,numnotaries,completed,minsigs,duration,numratified,isratify;
8 years ago
int8_t bestk;
8 years ago
cJSON *ratified;
uint8_t ratified_pubkeys[DPOW_MAXRELAYS][33]; char handles[DPOW_MAXRELAYS][32];
8 years ago
char signedtx[32768];//,rawtx[32768];
8 years ago
};
8 years ago
struct pax_transaction
{
UT_hash_handle hh;
bits256 txid;
uint64_t komodoshis,fiatoshis;
int32_t marked,height;
uint16_t vout;
char symbol[16],coinaddr[64]; uint8_t rmd160[20],shortflag;
};
struct dpow_info
{
8 years ago
char symbol[16],dest[16]; uint8_t minerkey33[33],minerid; uint64_t lastrecvmask;
struct dpow_checkpoint checkpoint,last,destchaintip,srcfifo[DPOW_FIFOSIZE],destfifo[DPOW_FIFOSIZE];
struct dpow_hashheight approved[DPOW_FIFOSIZE],notarized[DPOW_FIFOSIZE];
bits256 srctx[DPOW_MAXTX],desttx[DPOW_MAXTX];
8 years ago
uint32_t KMDREALTIME,destupdated,srcconfirms,numdesttx,numsrctx,lastsplit,cancelratify,crcs[16];
8 years ago
int32_t maxblocks,KMDHEIGHT,SHORTFLAG;
8 years ago
struct pax_transaction *PAX;
8 years ago
portable_mutex_t mutex;
8 years ago
struct dpow_block **blocks;
};
#endif