Browse Source

Test

etomic
jl777 7 years ago
parent
commit
d59aca98d1
  1. 4
      iguana/exchanges/DEXstats.h
  2. 2
      iguana/exchanges/LP_RTmetrics.c
  3. 12
      iguana/exchanges/LP_include.h
  4. 3
      iguana/exchanges/LP_nativeDEX.c
  5. 8
      iguana/exchanges/LP_portfolio.c
  6. 2
      iguana/exchanges/LP_prices.c
  7. 10
      iguana/exchanges/LP_remember.c
  8. 2
      iguana/exchanges/LP_rpc.c
  9. 2
      iguana/exchanges/LP_scan.c
  10. 6
      iguana/exchanges/LP_socket.c
  11. 4
      iguana/exchanges/mm.c
  12. 4
      iguana/exchanges/stats.c

4
iguana/exchanges/DEXstats.h

@ -51,7 +51,7 @@ struct DEXstats_pricepoint
struct DEXstats_pairinfo
{
char dest[16];
char dest[128];
int32_t numprices;
struct DEXstats_pricepoint *prices;
};
@ -64,7 +64,7 @@ struct DEXstats_datenuminfo
struct DEXstats_priceinfo
{
char symbol[16];
char symbol[128];
int32_t firstdatenum,numdates;
struct DEXstats_datenuminfo *dates;
} Prices[1024];

2
iguana/exchanges/LP_RTmetrics.c

@ -29,7 +29,7 @@ struct LP_metricinfo
struct LP_RTmetrics_pendings
{
char refbase[16],refrel[16];
char refbase[65],refrel[65];
int32_t numswaps,numavoidtxids,numwhitelist,numblacklist,numpendings,pending_swaps[1024];
bits256 avoidtxids[8192],whitelist[1024],blacklist[1024],pending_pubkeys[1024];
} LP_RTmetrics;

12
iguana/exchanges/LP_include.h

@ -166,7 +166,7 @@ struct basilisk_swap;
struct basilisk_rawtxinfo
{
char destaddr[64],coinstr[16];
char destaddr[64],coinstr[128];
bits256 txid,signedtxid,actualtxid;
int64_t amount,change,inputsum;
int32_t redeemlen,datalen,completed,vintype,vouttype,numconfirms,spendlen,secretstart,suppress_pubkeys;
@ -200,7 +200,7 @@ struct basilisk_rawtx
struct basilisk_swapinfo
{
struct basilisk_request req;
char bobstr[64],alicestr[64];
char bobstr[128],alicestr[128];
bits256 myhash,otherhash,orderhash;
uint32_t statebits,otherstatebits,started,expiration,finished,dead,reftime,putduration,callduration;
int32_t bobconfirms,aliceconfirms,iambob,reclaimed,bobspent,alicespent,pad,aliceistrusted,bobistrusted,otheristrusted,otherstrust,alicemaxconfirms,bobmaxconfirms;
@ -270,7 +270,7 @@ struct iguana_info
int32_t numutxos,longestchain,firstrefht,firstscanht,lastscanht,bussock,height; uint16_t busport;
uint32_t loadedcache,electrumlist,lastunspent,importedprivkey,lastpushtime,lastutxosync,addr_listunspent_requested,lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,obooktime;
uint8_t pubtype,p2shtype,isPoS,wiftype,wiftaddr,taddr,noimportprivkey_flag,userconfirms,isassetchain,maxconfirms;
char symbol[16],smartaddr[64],userpass[1024],serverport[128];
char symbol[128],smartaddr[64],userpass[1024],serverport[128];
// portfolio
double price_kmd,force,perc,goal,goalperc,relvolume,rate;
void *electrum; void *ctx;
@ -301,7 +301,7 @@ struct LP_utxoinfo
int32_t iambob,iamlp;
uint8_t key[sizeof(bits256) + sizeof(int32_t)];
uint8_t key2[sizeof(bits256) + sizeof(int32_t)];
char coin[16],coinaddr[64],gui[16];//spendscript[256];
char coin[65],coinaddr[64],gui[16];//spendscript[256];
};
struct LP_address_utxo
@ -340,7 +340,7 @@ struct LP_quoteinfo
uint64_t satoshis,txfee,destsatoshis,desttxfee,aliceid;
uint32_t timestamp,quotetime,tradeid;
int32_t vout,vout2,destvout,feevout,pair;
char srccoin[16],coinaddr[64],destcoin[16],destaddr[64],gui[64];
char srccoin[65],coinaddr[64],destcoin[65],destaddr[64],gui[64];
};
struct LP_endpoint { int32_t pair; char ipaddr[64]; uint16_t port; };
@ -384,7 +384,7 @@ struct electrum_info
int32_t bufsize,sock,*heightp,numerrors;
struct iguana_info *coin;
uint32_t stratumid,lasttime,keepalive,pending,*heighttimep;
char ipaddr[64],symbol[16];
char ipaddr[64],symbol[66];
uint16_t port;
uint8_t buf[];
};

3
iguana/exchanges/LP_nativeDEX.c

@ -26,6 +26,9 @@
// BCH signing
// dPoW security -> 4: KMD notarized, 5: BTC notarized, after next notary elections
// bigendian architectures need to use little endian for sighash calcs
//BTC LP_transaction_fromdata mismatched txid f78c80e831c02c89c0888e7d4438287030238e09e33f88da6df4dc84b949959b vs 1390f386f5997607e646be9c93f30018aa68ea971790b92b7b06e892656f0769
//failed blockchain.transaction.get BTC f78c80e831c02c89c0888e7d4438287030238e09e33f88da6df4dc84b949959b
//02000000000101242344292f9117c8318adb84f7991239361da2ff0a15ad2106d402945072cc110a0000001716001470eb5212b558cfc10b31f0849ef88ecf17097ac1ffffffff0c4a8321000000000017a914baed1c79cc6325333d5013b44dc17e8256bf5b718704bf3c000000000017a914255cf2809a1f42569c5c47c71e6234aac35a800f873099f400000000001976a914049877b81a8d6d8592919b75b9bcb4182f7c52cd88acb907e200000000001976a9140614fc114940e867210b09cc900db14d8bc58d2b88ac40771b00000000001976a9148cadbb1d7002d22d60e38ca238678d00f04ed22988ac002d3101000000001976a9140d05714431cf478846cea1435f9eabae9ad5c65388acc0f280010000000017a914c17a70c74154fc53263652aaca26c8d71683f1ba87aa2a4e00000000001976a914feea6b867954b1072962083233796d47e4c1665e88ace0e1de02000000001976a91445b71fbb02df53be5563257b77780b9afcc55bdc88acf6fe6700000000001976a91492332f8ff3b26e3ce2666afa5fee2e45308225af88ace74c1500000000001976a914fc7580f1ce24b2c85c80b2c8e641592b9bbf974588ac081ad000000000001976a9145e61c81c9b3ac55bf90ab00240023e8ddaf43e1788ac02483045022100a74be4e00585637c6792eeff9279508f09163db525f8b16c03e57283d12b0a6a022042cc061d70e78e9260ff30635db4f4e0b317831a8cb1f30473a25b93b4d1b4fb01210238288b60e8c50785809a69517ae3ca2fe3e407cac8b5868c5fb3803c233dfbcc00000000 data2json n.219 vs len.586
#include <stdio.h>
struct LP_millistats

8
iguana/exchanges/LP_portfolio.c

@ -18,7 +18,7 @@
// marketmaker
//
char LP_portfolio_base[16],LP_portfolio_rel[16];
char LP_portfolio_base[128],LP_portfolio_rel[128];
double LP_portfolio_relvolume;
cJSON *LP_portfolio_entry(struct iguana_info *coin)
@ -203,7 +203,7 @@ int32_t LP_autoprices,num_LP_autorefs;
struct LP_autoprice_ref
{
char refbase[16],refrel[16],base[16],rel[16];
char refbase[65],refrel[65],base[65],rel[65];
} LP_autorefs[100];
/*int32_t LP_autofill(char *base,char *rel,double maxprice,double totalrelvolume)
@ -325,7 +325,7 @@ double LP_pricesparse(void *ctx,int32_t trexflag,char *retstr,struct LP_priceinf
{
//{"success":true,"message":"","result":[{"MarketName":"BTC-KMD","High":0.00040840,"Low":0.00034900,"Volume":328042.46061669,"Last":0.00037236,"BaseVolume":123.36439511,"TimeStamp":"2017-07-15T13:50:21.87","Bid":0.00035721,"Ask":0.00037069,"OpenBuyOrders":343,"OpenSellOrders":1690,"PrevDay":0.00040875,"Created":"2017-02-11T23:04:01.853"},
//{"TradePairId":4762,"Label":"WAVES/BTC","AskPrice":0.00099989,"BidPrice":0.00097350,"Low":0.00095000,"High":0.00108838,"Volume":6501.24403100,"LastPrice":0.00098028,"BuyVolume":1058994.86554882,"SellVolume":2067.87377158,"Change":-7.46,"Open":0.00105926,"Close":0.00098028,"BaseVolume":6.52057452,"BuyBaseVolume":2.33098660,"SellBaseVolume":1167.77655709},
int32_t i,j,n,iter; double price,kmdbtc,bid,ask,nxtkmd=0.; struct LP_priceinfo *coinpp,*refpp; char symbol[16],*name,*refcoin; cJSON *retjson,*array,*item;
int32_t i,j,n,iter; double price,kmdbtc,bid,ask,nxtkmd=0.; struct LP_priceinfo *coinpp,*refpp; char symbol[65],*name,*refcoin; cJSON *retjson,*array,*item;
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
//printf("got.(%s)\n",retstr);
@ -553,7 +553,7 @@ int32_t LP_portfolio_trade(void *ctx,uint32_t *requestidp,uint32_t *quoteidp,str
else return(-1);
}
struct LP_portfoliotrade { double metric; char buycoin[16],sellcoin[16]; };
struct LP_portfoliotrade { double metric; char buycoin[65],sellcoin[65]; };
int32_t LP_portfolio_order(struct LP_portfoliotrade *trades,int32_t max,cJSON *array)
{

2
iguana/exchanges/LP_prices.c

@ -22,7 +22,7 @@ struct LP_orderbookentry { bits256 pubkey; double price; uint64_t minsatoshis,ma
struct LP_priceinfo
{
char symbol[16];
char symbol[68];
uint64_t coinbits;
int32_t ind,pad;
double diagval,high[2],low[2],last[2],bid[2],ask[2]; //volume,btcvolume,prevday; // mostly bittrex info

10
iguana/exchanges/LP_remember.c

@ -94,6 +94,10 @@ void basilisk_dontforget(struct basilisk_swap *swap,struct basilisk_rawtx *rawtx
if ( (fp= fopen(fname,"wb")) != 0 )
{
fprintf(fp,"{\"tradeid\":%u,\"aliceid\":\"%llu\",\"src\":\"%s\",\"srcamount\":%.8f,\"dest\":\"%s\",\"destamount\":%.8f,\"requestid\":%u,\"quoteid\":%u,\"iambob\":%d,\"state\":%u,\"otherstate\":%u,\"expiration\":%u,\"dlocktime\":%u,\"plocktime\":%u,\"Atxfee\":%llu,\"Btxfee\":%llu",swap->tradeid,(long long)swap->aliceid,swap->I.req.src,dstr(swap->I.req.srcamount),swap->I.req.dest,dstr(swap->I.req.destamount),swap->I.req.requestid,swap->I.req.quoteid,swap->I.iambob,swap->I.statebits,swap->I.otherstatebits,swap->I.expiration,swap->bobdeposit.I.locktime,swap->bobpayment.I.locktime,(long long)swap->I.Atxfee,(long long)swap->I.Btxfee);
if ( swap->I.iambob == 0 )
fprintf(fp,",\"Agui\":\"%s\"",G.gui);
else fprintf(fp,",\"Bgui\":\"%s\"",G.gui);
fprintf(fp,",\"gui\":\"%s\"",G.gui);
if ( memcmp(zeroes,swap->I.secretAm,20) != 0 )
{
init_hexbytes_noT(secretAmstr,swap->I.secretAm,20);
@ -455,6 +459,9 @@ cJSON *LP_swap_json(struct LP_swap_remember *rswap)
jaddnum(item,"requestid",rswap->requestid);
jaddnum(item,"quoteid",rswap->quoteid);
jaddnum(item,"iambob",rswap->iambob);
jaddstr(item,"Bgui",rswap->Bgui);
jaddstr(item,"Agui",rswap->Agui);
jaddstr(item,"gui",rswap->gui);
jaddstr(item,"bob",rswap->src);
jaddnum(item,"srcamount",dstr(rswap->srcamount));
jaddnum(item,"bobtxfee",dstr(rswap->Btxfee));
@ -503,6 +510,9 @@ int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t
if ( (item= cJSON_Parse(fstr)) != 0 )
{
rswap->iambob = jint(item,"iambob");
safecopy(rswap->Bgui,jstr(item,"Bgui"),sizeof(rswap->Bgui));
safecopy(rswap->Agui,jstr(item,"Agui"),sizeof(rswap->Agui));
safecopy(rswap->gui,jstr(item,"gui"),sizeof(rswap->gui));
rswap->tradeid = juint(item,"tradeid");
rswap->aliceid = j64bits(item,"aliceid");
if ( (secretstr= jstr(item,"secretAm")) != 0 && strlen(secretstr) == 40 )

2
iguana/exchanges/LP_rpc.c

@ -208,7 +208,7 @@ cJSON *LP_NXT_decrypt(uint64_t txnum,char *account,char *data,char *nonce,char *
cJSON *LP_NXT_redeems()
{
char url[1024],*retstr,*recv,*method,*msgstr,assetname[16]; uint64_t totals[20],mult,txnum,assetid,qty; int32_t i,ind,numtx,past_marker=0; cJSON *item,*attach,*decjson,*array,*msgjson,*encjson,*retjson=0;
char url[1024],*retstr,*recv,*method,*msgstr,assetname[128]; uint64_t totals[20],mult,txnum,assetid,qty; int32_t i,ind,numtx,past_marker=0; cJSON *item,*attach,*decjson,*array,*msgjson,*encjson,*retjson=0;
uint64_t txnum_marker = calc_nxt64bits("0");
uint64_t txnum_marker2 = calc_nxt64bits("7256847492742571143");
char *passphrase = "";

2
iguana/exchanges/LP_scan.c

@ -127,7 +127,7 @@ int sort_balance(void *a,void *b)
cJSON *LP_snapshot(struct iguana_info *coin,int32_t height)
{
static bits256 bannedarray[64]; static int32_t numbanned,indallvouts,maxsnapht; static char lastcoin[16];
static bits256 bannedarray[64]; static int32_t numbanned,indallvouts,maxsnapht; static char lastcoin[65];
struct LP_transaction *tx,*tmp; struct LP_address *ap,*atmp; int32_t isKMD,i,j,n,skipflag=0,startht,endht,ht; uint64_t banned_balance=0,balance=0,noaddr_balance=0; cJSON *retjson,*array,*item;
if ( bannedarray[0].txid == 0 )
numbanned = komodo_bannedset(&indallvouts,bannedarray,(int32_t)(sizeof(bannedarray)/sizeof(*bannedarray)));

6
iguana/exchanges/LP_socket.c

@ -98,7 +98,7 @@ int32_t LP_socket(int32_t bindflag,char *hostname,uint16_t port)
#endif
expand_ipbits(checkipaddr,saddr.sin_addr.s_addr);
if ( strcmp(ipaddr,checkipaddr) != 0 )
printf("bindflag.%d iguana_socket mismatch (%s) -> (%s)?\n",bindflag,checkipaddr,ipaddr);
printf("bindflag.%d iguana_socket mismatch (%s) -> (%s)\n",bindflag,checkipaddr,ipaddr);
//#endif
if ( (sock= socket(AF_INET,SOCK_STREAM,0)) < 0 )
{
@ -578,8 +578,8 @@ cJSON *electrum_address_listunspent(char *symbol,struct electrum_info *ep,cJSON
cJSON *retjson=0; char *retstr; struct LP_address *ap; struct iguana_info *coin; int32_t updatedflag,height,usecache=1;
if ( (coin= LP_coinfind(symbol)) == 0 )
return(0);
if ( strcmp(addr,INSTANTDEX_KMD) == 0 )
return(cJSON_Parse("[]"));
//if ( strcmp(addr,INSTANTDEX_KMD) == 0 )
// return(cJSON_Parse("[]"));
if ( ep == 0 || ep->heightp == 0 )
height = coin->longestchain;
else height = *(ep->heightp);

4
iguana/exchanges/mm.c

@ -74,7 +74,7 @@ struct mmpending_order
int32_t dir;
uint32_t pending,completed,canceled,cancelstarted,reported;
cJSON *errorjson;
char exchange[16],base[16],rel[16],orderid[64];
char exchange[16],base[65],rel[65],orderid[64];
} *Pending_orders;
int32_t Num_Pending;
@ -415,7 +415,7 @@ void marketmaker_pendingupdate(char *exchange,char *base,char *rel)
void marketmaker_pendinginit(char *exchange,char *base,char *rel)
{
char *retstr,*orderid,*pairstr,relbase[64]; cJSON *retjson,*array,*item; int32_t i,j,n,dir; struct mmpending_order *ptr;
char *retstr,*orderid,*pairstr,relbase[65]; cJSON *retjson,*array,*item; int32_t i,j,n,dir; struct mmpending_order *ptr;
sprintf(relbase,"%s-%s",rel,base);
if ( (retstr= DEX_openorders(exchange)) != 0 )
{

4
iguana/exchanges/stats.c

@ -62,7 +62,7 @@ char CURRENCIES[][8] = { "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD",
"CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK", // end of currencies
};
char ASSETCHAINS_SYMBOL[16] = { "KV" };
char ASSETCHAINS_SYMBOL[65] = { "KV" };
struct komodo_state
{
@ -1090,7 +1090,7 @@ int32_t komodo_parsestatefile(FILE *logfp,struct komodo_state *sp,FILE *fp,char
int32_t stats_stateupdate(FILE *logfp,char *destdir,char *statefname,int32_t maxseconds,char *komodofile)
{
static long lastpos[2];
char symbol[64],base[64]; int32_t iter,n; FILE *fp; uint32_t starttime; struct komodo_state *sp;
char symbol[65],base[65]; int32_t iter,n; FILE *fp; uint32_t starttime; struct komodo_state *sp;
starttime = (uint32_t)time(NULL);
strcpy(base,"KV");
strcpy(symbol,"KV");

Loading…
Cancel
Save