New refs
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "CCinclude.h"
|
||||
int32_t prices_extract(int64_t *pricedata,int32_t firstheight,int32_t numblocks,int32_t ind);
|
||||
int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks);
|
||||
|
||||
#define PRICES_DAYWINDOW ((3600*24/ASSETCHAINS_BLOCKTIME) + 1)
|
||||
#define PRICES_TXFEE 10000
|
||||
|
||||
@@ -57,25 +57,21 @@ extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_NOTARY_PAY
|
||||
extern const char *ASSETCHAINS_ALGORITHMS[];
|
||||
extern int32_t VERUS_MIN_STAKEAGE;
|
||||
extern uint32_t ASSETCHAINS_VERUSHASH, ASSETCHAINS_VERUSHASHV1_1, ASSETCHAINS_NONCESHIFT[], ASSETCHAINS_HASHESPERROUND[];
|
||||
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
||||
extern std::string NOTARY_PUBKEY,ASSETCHAINS_OVERRIDE_PUBKEY,ASSETCHAINS_SCRIPTPUB;
|
||||
extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_MARMARA;
|
||||
extern std::vector<std::string> ASSETCHAINS_PRICES,ASSETCHAINS_STOCKS;
|
||||
|
||||
extern char ASSETCHAINS_SYMBOL[65];
|
||||
extern int32_t VERUS_BLOCK_POSUNITS, VERUS_CONSECUTIVE_POS_THRESHOLD, VERUS_NOPOS_THRESHHOLD;
|
||||
|
||||
|
||||
extern int32_t KOMODO_CONNECTING,KOMODO_CCACTIVATE,KOMODO_DEALERNODE;
|
||||
extern uint32_t ASSETCHAINS_CC;
|
||||
extern char ASSETCHAINS_SYMBOL[];
|
||||
extern std::string CCerror,ASSETCHAINS_CCLIB;
|
||||
extern uint8_t ASSETCHAINS_CCDISABLES[256];
|
||||
|
||||
extern int32_t USE_EXTERNAL_PUBKEY;
|
||||
extern std::string NOTARY_PUBKEY;
|
||||
extern int32_t KOMODO_EXCHANGEWALLET;
|
||||
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
||||
extern int32_t VERUS_MIN_STAKEAGE;
|
||||
extern std::string DONATION_PUBKEY;
|
||||
extern uint8_t ASSETCHAINS_PRIVATE;
|
||||
@@ -85,8 +81,31 @@ int tx_height( const uint256 &hash );
|
||||
extern std::vector<std::string> vWhiteListAddress;
|
||||
void komodo_netevent(std::vector<uint8_t> payload);
|
||||
|
||||
#define IGUANA_MAXSCRIPTSIZE 10001
|
||||
#define KOMODO_KVDURATION 1440
|
||||
#define KOMODO_KVBINARY 2
|
||||
#define PRICES_SMOOTHWIDTH 1
|
||||
uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume);
|
||||
int32_t komodo_paxprices(int32_t *heights,uint64_t *prices,int32_t max,char *base,char *rel);
|
||||
int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
|
||||
char *bitcoin_address(char *coinaddr,uint8_t addrtype,uint8_t *pubkey_or_rmd160,int32_t len);
|
||||
int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width);
|
||||
int32_t komodo_kvsearch(uint256 *refpubkeyp,int32_t current_height,uint32_t *flagsp,int32_t *heightp,uint8_t value[IGUANA_MAXSCRIPTSIZE],uint8_t *key,int32_t keylen);
|
||||
|
||||
int32_t komodo_longestchain();
|
||||
int32_t komodo_dpowconfs(int32_t height,int32_t numconfs);
|
||||
int8_t komodo_segid(int32_t nocache,int32_t height);
|
||||
int32_t komodo_heightpricebits(uint64_t *seedp,uint32_t *heightbits,int32_t nHeight);
|
||||
char *komodo_pricename(char *name,int32_t ind);
|
||||
int32_t komodo_priceind(char *symbol);
|
||||
int32_t komodo_pricesinit();
|
||||
int64_t komodo_priceave(int64_t *tmpbuf,int64_t *correlated,int32_t cskip);
|
||||
int64_t komodo_pricecorrelated(uint64_t seed,int32_t ind,uint32_t *rawprices,int32_t rawskip,uint32_t *nonzprices,int32_t smoothwidth);
|
||||
int32_t komodo_nextheight();
|
||||
uint32_t komodo_heightstamp(int32_t height);
|
||||
int64_t komodo_pricemult(int32_t ind);
|
||||
int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks);
|
||||
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2707,6 +2707,14 @@ int32_t komodo_pricesinit()
|
||||
return(0);
|
||||
}
|
||||
|
||||
pthread_mutex_t pricemutex;
|
||||
|
||||
// PRICES file layouts
|
||||
// [0] rawprice32 / timestamp
|
||||
// [1] correlated
|
||||
// [2] 24hr ave
|
||||
// [3] to [7] reserved
|
||||
|
||||
void komodo_pricesupdate(int32_t height,CBlock *pblock)
|
||||
{
|
||||
static int numprices; static uint32_t *ptr32; static int64_t *ptr64,*tmpbuf;
|
||||
@@ -2714,6 +2722,7 @@ void komodo_pricesupdate(int32_t height,CBlock *pblock)
|
||||
width = PRICES_DAYWINDOW;//(2*PRICES_DAYWINDOW + PRICES_SMOOTHWIDTH);
|
||||
if ( numprices == 0 )
|
||||
{
|
||||
pthread_mutex_init(&pricemutex,0);
|
||||
numprices = (int32_t)(komodo_cbopretsize(ASSETCHAINS_CBOPRET) / sizeof(uint32_t));
|
||||
ptr32 = (uint32_t *)calloc(sizeof(uint32_t),numprices * width);
|
||||
ptr64 = (int64_t *)calloc(sizeof(int64_t),PRICES_DAYWINDOW*PRICES_MAXDATAPOINTS);
|
||||
@@ -2727,6 +2736,7 @@ void komodo_pricesupdate(int32_t height,CBlock *pblock)
|
||||
//fprintf(stderr,"numprices.%d\n",numprices);
|
||||
if ( PRICES[0].fp != 0 )
|
||||
{
|
||||
pthread_mutex_lock(&pricemutex);
|
||||
fseek(PRICES[0].fp,height * numprices * sizeof(uint32_t),SEEK_SET);
|
||||
if ( fwrite(rawprices,sizeof(uint32_t),numprices,PRICES[0].fp) != numprices )
|
||||
fprintf(stderr,"error writing rawprices for ht.%d\n",height);
|
||||
@@ -2774,8 +2784,22 @@ void komodo_pricesupdate(int32_t height,CBlock *pblock)
|
||||
fprintf(stderr,"height.%d\n",height);
|
||||
} else fprintf(stderr,"error reading rawprices for ht.%d\n",height);
|
||||
} else fprintf(stderr,"height.%d <= width.%d\n",height,width);
|
||||
pthread_mutex_unlock(&pricemutex);
|
||||
} else fprintf(stderr,"null PRICES[0].fp\n");
|
||||
} else fprintf(stderr,"numprices mismatch, height.%d\n",height);
|
||||
}
|
||||
|
||||
int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks)
|
||||
{
|
||||
FILE *fp; int32_t retval = PRICES_MAXDATAPOINTS;
|
||||
pthread_mutex_lock(&pricemutex);
|
||||
if ( ind < KOMODO_MAXPRICES && (fp= PRICES[ind].fp) != 0 )
|
||||
{
|
||||
fseek(fp,height * PRICES_MAXDATAPOINTS * sizeof(int64_t),SEEK_SET);
|
||||
if ( fread(buf64,sizeof(int64_t),numblocks*PRICES_MAXDATAPOINTS,fp) != numblocks*PRICES_MAXDATAPOINTS )
|
||||
retval = -1;
|
||||
}
|
||||
pthread_mutex_unlock(&pricemutex);
|
||||
return(retval);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,10 +47,8 @@ using namespace std;
|
||||
|
||||
extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry);
|
||||
void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex);
|
||||
int32_t komodo_longestchain();
|
||||
int32_t komodo_dpowconfs(int32_t height,int32_t numconfs);
|
||||
extern int8_t komodo_segid(int32_t nocache,int32_t height);
|
||||
extern int32_t KOMODO_LONGESTCHAIN;
|
||||
#include "komodo_defs.h"
|
||||
#include "komodo_structs.h"
|
||||
|
||||
double GetDifficultyINTERNAL(const CBlockIndex* blockindex, bool networkDifficulty)
|
||||
{
|
||||
@@ -628,8 +626,6 @@ UniValue getblockhash(const UniValue& params, bool fHelp)
|
||||
return pblockindex->GetBlockHash().GetHex();
|
||||
}
|
||||
|
||||
extern int32_t ASSETCHAINS_STAKED;
|
||||
|
||||
UniValue getlastsegidstakes(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 1)
|
||||
@@ -915,20 +911,6 @@ UniValue gettxoutsetinfo(const UniValue& params, bool fHelp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "komodo_defs.h"
|
||||
#include "komodo_structs.h"
|
||||
|
||||
#define IGUANA_MAXSCRIPTSIZE 10001
|
||||
#define KOMODO_KVDURATION 1440
|
||||
#define KOMODO_KVBINARY 2
|
||||
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
||||
extern int32_t ASSETCHAINS_LWMAPOS;
|
||||
uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume);
|
||||
int32_t komodo_paxprices(int32_t *heights,uint64_t *prices,int32_t max,char *base,char *rel);
|
||||
int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
|
||||
char *bitcoin_address(char *coinaddr,uint8_t addrtype,uint8_t *pubkey_or_rmd160,int32_t len);
|
||||
int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width);
|
||||
int32_t komodo_kvsearch(uint256 *refpubkeyp,int32_t current_height,uint32_t *flagsp,int32_t *heightp,uint8_t value[IGUANA_MAXSCRIPTSIZE],uint8_t *key,int32_t keylen);
|
||||
|
||||
UniValue kvsearch(const UniValue& params, bool fHelp)
|
||||
{
|
||||
@@ -1174,15 +1156,6 @@ UniValue paxprice(const UniValue& params, bool fHelp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t komodo_heightpricebits(uint64_t *seedp,uint32_t *heightbits,int32_t nHeight);
|
||||
char *komodo_pricename(char *name,int32_t ind);
|
||||
int64_t komodo_priceave(int64_t *tmpbuf,int64_t *correlated,int32_t cskip);
|
||||
int64_t komodo_pricecorrelated(uint64_t seed,int32_t ind,uint32_t *rawprices,int32_t rawskip,uint32_t *nonzprices,int32_t smoothwidth);
|
||||
int32_t komodo_nextheight();
|
||||
uint32_t komodo_heightstamp(int32_t height);
|
||||
int64_t komodo_pricemult(int32_t ind);
|
||||
#define PRICES_SMOOTHWIDTH 1
|
||||
|
||||
int32_t prices_extract(int64_t *pricedata,int32_t firstheight,int32_t numblocks,int32_t ind)
|
||||
{
|
||||
int32_t height,i,n,width,numpricefeeds = -1; uint64_t seed,ignore,rngval; uint32_t rawprices[1440*6],*ptr; int64_t *tmpbuf;
|
||||
@@ -1324,8 +1297,6 @@ UniValue prices(const UniValue& params, bool fHelp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight);
|
||||
|
||||
UniValue gettxout(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() < 2 || params.size() > 3)
|
||||
|
||||
Reference in New Issue
Block a user