@ -16,6 +16,12 @@
# ifndef H_IGUANASTRUCTS_H
# ifndef H_IGUANASTRUCTS_H
# define H_IGUANASTRUCTS_H
# define H_IGUANASTRUCTS_H
# ifdef __WIN32
# define PACKEDSTRUCT
# else
# define PACKEDSTRUCT __attribute__((packed))
# endif
struct iguana_thread
struct iguana_thread
{
{
struct queueitem DL ;
struct queueitem DL ;
@ -53,7 +59,7 @@ struct iguana_chain
uint16_t targetspacing , targettimespan ; uint32_t nBits , normal_txversion , locktime_txversion ;
uint16_t targetspacing , targettimespan ; uint32_t nBits , normal_txversion , locktime_txversion ;
} ;
} ;
struct iguana_msgaddress { uint32_t nTime ; uint64_t nServices ; uint8_t ip [ 16 ] ; uint16_t port ; } ; // __attribute__((packed));
struct iguana_msgaddress { uint32_t nTime ; uint64_t nServices ; uint8_t ip [ 16 ] ; uint16_t port ; } PACKEDSTRUCT ;
struct iguana_msgversion
struct iguana_msgversion
{
{
@ -65,7 +71,7 @@ struct iguana_msgversion
char strSubVer [ 80 ] ;
char strSubVer [ 80 ] ;
uint32_t nStartingHeight ;
uint32_t nStartingHeight ;
uint8_t relayflag ;
uint8_t relayflag ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_msgalert // warning, many varints/variable length fields, struct is 1:1
struct iguana_msgalert // warning, many varints/variable length fields, struct is 1:1
{
{
@ -91,14 +97,14 @@ struct iguana_VPNversion
char strSubVer [ 80 ] ;
char strSubVer [ 80 ] ;
uint32_t nStartingHeight ;
uint32_t nStartingHeight ;
uint32_t iVer , v_Network_id ; uint16_t wPort ; uint8_t bIsGui ; uint16_t wCtPort , wPrPort ;
uint32_t iVer , v_Network_id ; uint16_t wPort ; uint8_t bIsGui ; uint16_t wCtPort , wPrPort ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_msgblockhdr
struct iguana_msgblockhdr
{
{
uint32_t version ;
uint32_t version ;
bits256 prev_block , merkle_root ;
bits256 prev_block , merkle_root ;
uint32_t timestamp , bits , nonce ;
uint32_t timestamp , bits , nonce ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
# define ZKSNARK_PROOF_SIZE 584
# define ZKSNARK_PROOF_SIZE 584
# define ZCASH_SOLUTION_ELEMENTS 32
# define ZCASH_SOLUTION_ELEMENTS 32
@ -109,25 +115,25 @@ struct iguana_msgblockhdr_zcash
uint8_t numelements ;
uint8_t numelements ;
uint32_t solution [ ZCASH_SOLUTION_ELEMENTS ] ;
uint32_t solution [ ZCASH_SOLUTION_ELEMENTS ] ;
//bits256 reserved; // only here if auxpow is set
//bits256 reserved; // only here if auxpow is set
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_msgmerkle
struct iguana_msgmerkle
{
{
uint32_t branch_length ;
uint32_t branch_length ;
bits256 branch_hash [ 4096 ] ;
bits256 branch_hash [ 4096 ] ;
uint32_t branch_side_mask ;
uint32_t branch_side_mask ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_msgblock
struct iguana_msgblock
{
{
struct iguana_msgblockhdr H ; // double hashed for blockhash
struct iguana_msgblockhdr H ; // double hashed for blockhash
struct iguana_msgblockhdr_zcash zH ;
struct iguana_msgblockhdr_zcash zH ;
uint32_t txn_count ;
uint32_t txn_count ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_msgvin { bits256 prev_hash ; uint8_t * vinscript , * userdata , * spendscript , * redeemscript ; uint32_t prev_vout , sequence ; uint16_t scriptlen , p2shlen , userdatalen , spendlen ; } ; // __attribute__((packed));
struct iguana_msgvin { bits256 prev_hash ; uint8_t * vinscript , * userdata , * spendscript , * redeemscript ; uint32_t prev_vout , sequence ; uint16_t scriptlen , p2shlen , userdatalen , spendlen ; } PACKEDSTRUCT ;
struct iguana_msgvout { uint64_t value ; uint32_t pk_scriptlen ; uint8_t * pk_script ; } ; // __attribute__((packed));
struct iguana_msgvout { uint64_t value ; uint32_t pk_scriptlen ; uint8_t * pk_script ; } PACKEDSTRUCT ;
struct iguana_msgtx
struct iguana_msgtx
{
{
@ -138,7 +144,7 @@ struct iguana_msgtx
int32_t allocsize , timestamp , numinputs , numoutputs ;
int32_t allocsize , timestamp , numinputs , numoutputs ;
int64_t inputsum , outputsum , txfee ;
int64_t inputsum , outputsum , txfee ;
uint8_t * serialized ;
uint8_t * serialized ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_msgjoinsplit
struct iguana_msgjoinsplit
{
{
@ -147,7 +153,7 @@ struct iguana_msgjoinsplit
uint8_t ciphertexts [ 2 ] [ 217 ] ;
uint8_t ciphertexts [ 2 ] [ 217 ] ;
bits256 randomseed , vmacs [ 2 ] ;
bits256 randomseed , vmacs [ 2 ] ;
uint8_t zkproof [ ZKSNARK_PROOF_SIZE - 1 ] ;
uint8_t zkproof [ ZKSNARK_PROOF_SIZE - 1 ] ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_packet { struct queueitem DL ; struct iguana_peer * addr ; struct tai embargo ; int32_t datalen , getdatablock ; uint8_t serialized [ ] ; } ;
struct iguana_packet { struct queueitem DL ; struct iguana_peer * addr ; struct tai embargo ; int32_t datalen , getdatablock ; uint8_t serialized [ ] ; } ;
@ -155,7 +161,7 @@ struct msgcounts { uint32_t version,verack,getaddr,addr,inv,getdata,notfound,get
struct iguana_fileitem { bits256 hash2 ; struct iguana_txdatabits txdatabits ; } ;
struct iguana_fileitem { bits256 hash2 ; struct iguana_txdatabits txdatabits ; } ;
struct iguana_kvitem { UT_hash_handle hh ; uint8_t keyvalue [ ] ; } ; // __attribute__((packed));
struct iguana_kvitem { UT_hash_handle hh ; uint8_t keyvalue [ ] ; } PACKEDSTRUCT ;
struct iguana_iAddr
struct iguana_iAddr
{
{
@ -173,15 +179,15 @@ struct iguana_blockRO
uint32_t timestamp , nonce , bits , version ;
uint32_t timestamp , nonce , bits , version ;
uint32_t firsttxidind , firstvin , firstvout , firstpkind , firstexternalind , recvlen : 24 , tbd : 8 ;
uint32_t firsttxidind , firstvin , firstvout , firstpkind , firstexternalind , recvlen : 24 , tbd : 8 ;
uint16_t txn_count , numvouts , numvins , allocsize ;
uint16_t txn_count , numvouts , numvins , allocsize ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_zcashRO { bits256 bignonce ; uint32_t solution [ ZCASH_SOLUTION_ELEMENTS ] ; } ; // __attribute__((packed));
struct iguana_zcashRO { bits256 bignonce ; uint32_t solution [ ZCASH_SOLUTION_ELEMENTS ] ; } PACKEDSTRUCT ;
struct iguana_zblockRO
struct iguana_zblockRO
{
{
struct iguana_blockRO RO ;
struct iguana_blockRO RO ;
struct iguana_zcashRO zRO ;
struct iguana_zcashRO zRO ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
# define iguana_blockfields double PoW; \
# define iguana_blockfields double PoW; \
int32_t height , fpos ; uint32_t fpipbits , issued , lag : 18 , sigsvalid : 1 , protected : 1 , peerid : 12 ; \
int32_t height , fpos ; uint32_t fpipbits , issued , lag : 18 , sigsvalid : 1 , protected : 1 , peerid : 12 ; \
@ -193,13 +199,13 @@ struct iguana_block
{
{
iguana_blockfields ;
iguana_blockfields ;
struct iguana_zcashRO zRO [ ] ;
struct iguana_zcashRO zRO [ ] ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_zblock // mu
struct iguana_zblock // mu
{
{
iguana_blockfields ;
iguana_blockfields ;
struct iguana_zcashRO zRO ;
struct iguana_zcashRO zRO ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
# define IGUANA_LHASH_BLOCKS 0
# define IGUANA_LHASH_BLOCKS 0
# define IGUANA_LHASH_TXIDS 1 //
# define IGUANA_LHASH_TXIDS 1 //
@ -218,7 +224,7 @@ struct iguana_counts
uint32_t firsttxidind , firstunspentind , firstspendind , firstpkind ;
uint32_t firsttxidind , firstunspentind , firstspendind , firstpkind ;
uint64_t credits , debits ;
uint64_t credits , debits ;
struct iguana_block block ;
struct iguana_block block ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_blocks
struct iguana_blocks
{
{
@ -233,34 +239,34 @@ struct iguana_ledger
{
{
struct iguana_counts snapshot ;
struct iguana_counts snapshot ;
//struct iguana_account accounts[];
//struct iguana_account accounts[];
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
// ramchain temp file structures
// ramchain temp file structures
struct iguana_unspent20 { uint64_t value ; uint32_t scriptpos , txidind : 28 , type : 4 ; uint16_t scriptlen , fileid ; uint8_t rmd160 [ 20 ] ; } ; // __attribute__((packed));
struct iguana_unspent20 { uint64_t value ; uint32_t scriptpos , txidind : 28 , type : 4 ; uint16_t scriptlen , fileid ; uint8_t rmd160 [ 20 ] ; } PACKEDSTRUCT ;
struct iguana_spend256 { bits256 prevhash2 ; uint64_t scriptpos : 48 , vinscriptlen : 16 ; uint32_t sequenceid ; int16_t prevout ; uint16_t spendind , fileid ; } ; // __attribute__((packed));
struct iguana_spend256 { bits256 prevhash2 ; uint64_t scriptpos : 48 , vinscriptlen : 16 ; uint32_t sequenceid ; int16_t prevout ; uint16_t spendind , fileid ; } PACKEDSTRUCT ;
// permanent readonly structs
// permanent readonly structs
struct iguana_txid { bits256 txid ; uint64_t txidind : 29 , firstvout : 28 , firstvin : 28 , bundlei : 11 , locktime : 32 , version : 32 , timestamp : 32 , extraoffset : 32 ; uint16_t numvouts , numvins ; } ; // __attribute__((packed));
struct iguana_txid { bits256 txid ; uint64_t txidind : 29 , firstvout : 28 , firstvin : 28 , bundlei : 11 , locktime : 32 , version : 32 , timestamp : 32 , extraoffset : 32 ; uint16_t numvouts , numvins ; } PACKEDSTRUCT ;
struct iguana_unspent { uint64_t value ; uint32_t txidind , pkind , prevunspentind , scriptpos ; uint16_t scriptlen , hdrsi ; uint16_t fileid : 11 , type : 5 ; int16_t vout ; } ; // __attribute__((packed));
struct iguana_unspent { uint64_t value ; uint32_t txidind , pkind , prevunspentind , scriptpos ; uint16_t scriptlen , hdrsi ; uint16_t fileid : 11 , type : 5 ; int16_t vout ; } PACKEDSTRUCT ;
struct iguana_spend { uint64_t scriptpos : 48 , scriptlen : 16 ; uint32_t spendtxidind , sequenceid ; int16_t prevout ; uint16_t fileid : 15 , external : 1 ; } ; // __attribute__((packed)); // numsigs:4,numpubkeys:4,p2sh:1,sighash:4
struct iguana_spend { uint64_t scriptpos : 48 , scriptlen : 16 ; uint32_t spendtxidind , sequenceid ; int16_t prevout ; uint16_t fileid : 15 , external : 1 ; } PACKEDSTRUCT ; // numsigs:4,numpubkeys:4,p2sh:1,sighash:4
struct iguana_pkhash { uint8_t rmd160 [ 20 ] ; uint32_t pkind ; } ; // __attribute__((packed)); //firstunspentind,pubkeyoffset
struct iguana_pkhash { uint8_t rmd160 [ 20 ] ; uint32_t pkind ; } PACKEDSTRUCT ; //firstunspentind,pubkeyoffset
// dynamic
// dynamic
struct iguana_account { int64_t total ; uint32_t lastunspentind ; } ; // __attribute__((packed));
struct iguana_account { int64_t total ; uint32_t lastunspentind ; } PACKEDSTRUCT ;
struct iguana_utxo { uint32_t fromheight : 31 , lockedflag : 1 , prevunspentind : 31 , spentflag : 1 , spendind ; } ; // __attribute__((packed));
struct iguana_utxo { uint32_t fromheight : 31 , lockedflag : 1 , prevunspentind : 31 , spentflag : 1 , spendind ; } PACKEDSTRUCT ;
# ifdef DEPRECATED_HHUTXO
# ifdef DEPRECATED_HHUTXO
struct iguana_hhaccount { UT_hash_handle hh ; uint64_t pval ; struct iguana_account a ; } ; // __attribute__((packed));
struct iguana_hhaccount { UT_hash_handle hh ; uint64_t pval ; struct iguana_account a ; } PACKEDSTRUCT ;
# endif
# endif
struct iguana_hhutxo { UT_hash_handle hh ; uint64_t uval ; struct iguana_utxo u ; } ; // __attribute__((packed));
struct iguana_hhutxo { UT_hash_handle hh ; uint64_t uval ; struct iguana_utxo u ; } PACKEDSTRUCT ;
struct iguana_utxoaddr { UT_hash_handle hh ; int64_t histbalance ; uint32_t pkind : 31 , searchedhist : 1 ; uint16_t hdrsi ; uint8_t rmd160 [ 20 ] ; } ; // __attribute__((packed));
struct iguana_utxoaddr { UT_hash_handle hh ; int64_t histbalance ; uint32_t pkind : 31 , searchedhist : 1 ; uint16_t hdrsi ; uint8_t rmd160 [ 20 ] ; } PACKEDSTRUCT ;
// GLOBAL one zero to non-zero write (unless reorg)
// GLOBAL one zero to non-zero write (unless reorg)
struct iguana_spendvector { uint64_t value ; uint32_t pkind , unspentind ; int32_t fromheight ; uint16_t hdrsi : 15 , tmpflag : 1 ; } ; // __attribute__((packed)); // unspentind
struct iguana_spendvector { uint64_t value ; uint32_t pkind , unspentind ; int32_t fromheight ; uint16_t hdrsi : 15 , tmpflag : 1 ; } PACKEDSTRUCT ; // unspentind
//struct iguana_pkextra { uint32_t firstspendind; } __attribute__((packed)) ; // pkind
//struct iguana_pkextra { uint32_t firstspendind; } PACKEDSTRUCT ; // pkind
struct iguana_txblock
struct iguana_txblock
{
{