@ -16,6 +16,12 @@
# ifndef H_IGUANASTRUCTS_H
# define H_IGUANASTRUCTS_H
# ifdef __WIN32
# define PACKEDSTRUCT
# else
# define PACKEDSTRUCT __attribute__((packed))
# endif
struct iguana_thread
{
struct queueitem DL ;
@ -53,7 +59,7 @@ struct iguana_chain
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
{
@ -65,7 +71,7 @@ struct iguana_msgversion
char strSubVer [ 80 ] ;
uint32_t nStartingHeight ;
uint8_t relayflag ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_msgalert // warning, many varints/variable length fields, struct is 1:1
{
@ -91,14 +97,14 @@ struct iguana_VPNversion
char strSubVer [ 80 ] ;
uint32_t nStartingHeight ;
uint32_t iVer , v_Network_id ; uint16_t wPort ; uint8_t bIsGui ; uint16_t wCtPort , wPrPort ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_msgblockhdr
{
uint32_t version ;
bits256 prev_block , merkle_root ;
uint32_t timestamp , bits , nonce ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
# define ZKSNARK_PROOF_SIZE 584
# define ZCASH_SOLUTION_ELEMENTS 32
@ -109,25 +115,25 @@ struct iguana_msgblockhdr_zcash
uint8_t numelements ;
uint32_t solution [ ZCASH_SOLUTION_ELEMENTS ] ;
//bits256 reserved; // only here if auxpow is set
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_msgmerkle
{
uint32_t branch_length ;
bits256 branch_hash [ 4096 ] ;
uint32_t branch_side_mask ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_msgblock
{
struct iguana_msgblockhdr H ; // double hashed for blockhash
struct iguana_msgblockhdr_zcash zH ;
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
{
@ -138,7 +144,7 @@ struct iguana_msgtx
int32_t allocsize , timestamp , numinputs , numoutputs ;
int64_t inputsum , outputsum , txfee ;
uint8_t * serialized ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_msgjoinsplit
{
@ -147,7 +153,7 @@ struct iguana_msgjoinsplit
uint8_t ciphertexts [ 2 ] [ 217 ] ;
bits256 randomseed , vmacs [ 2 ] ;
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 [ ] ; } ;
@ -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_kvitem { UT_hash_handle hh ; uint8_t keyvalue [ ] ; } ; // __attribute__((packed));
struct iguana_kvitem { UT_hash_handle hh ; uint8_t keyvalue [ ] ; } PACKEDSTRUCT ;
struct iguana_iAddr
{
@ -173,15 +179,15 @@ struct iguana_blockRO
uint32_t timestamp , nonce , bits , version ;
uint32_t firsttxidind , firstvin , firstvout , firstpkind , firstexternalind , recvlen : 24 , tbd : 8 ;
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_blockRO RO ;
struct iguana_zcashRO zRO ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
# define iguana_blockfields double PoW; \
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 ;
struct iguana_zcashRO zRO [ ] ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_zblock // mu
{
iguana_blockfields ;
struct iguana_zcashRO zRO ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
# define IGUANA_LHASH_BLOCKS 0
# define IGUANA_LHASH_TXIDS 1 //
@ -218,7 +224,7 @@ struct iguana_counts
uint32_t firsttxidind , firstunspentind , firstspendind , firstpkind ;
uint64_t credits , debits ;
struct iguana_block block ;
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
struct iguana_blocks
{
@ -233,34 +239,34 @@ struct iguana_ledger
{
struct iguana_counts snapshot ;
//struct iguana_account accounts[];
} ; // __attribute__((packed));
} PACKEDSTRUCT ;
// 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_spend256 { bits256 prevhash2 ; uint64_t scriptpos : 48 , vinscriptlen : 16 ; uint32_t sequenceid ; int16_t prevout ; uint16_t spendind , fileid ; } ; // __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 ; } PACKEDSTRUCT ;
// 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
struct iguana_account { int64_t total ; uint32_t lastunspentind ; } ; // __attribute__((packed));
struct iguana_utxo { uint32_t fromheight : 31 , lockedflag : 1 , prevunspentind : 31 , spentflag : 1 , spendind ; } ; // __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 ; } PACKEDSTRUCT ;
# 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
struct iguana_hhutxo { UT_hash_handle hh ; uint64_t uval ; struct iguana_utxo u ; } ; // __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 ] ; } ; // __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 ] ; } PACKEDSTRUCT ;
// 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_pkextra { uint32_t firstspendind; } __attribute__((packed)) ; // pkind
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; } PACKEDSTRUCT ; // pkind
struct iguana_txblock
{