Browse Source

Merge pull request #163 from jl777/dev

Dev
win-cross
jl777 8 years ago
committed by GitHub
parent
commit
ed95418807
  1. 4
      basilisk/basilisk.c
  2. 2
      basilisk/basilisk.h
  3. 77
      basilisk/basilisk_DEX.c
  4. 41
      basilisk/basilisk_MSG.c
  5. 42
      basilisk/basilisk_bitcoin.c
  6. 57
      basilisk/basilisk_swap.c
  7. 13
      basilisk/basilisk_tradebot.c
  8. 9
      iguana/dPoW.h
  9. 2
      iguana/dpow/dpow_fsm.c
  10. 162
      iguana/dpow/dpow_network.c
  11. 52
      iguana/dpowassets
  12. 4
      iguana/iguana777.c
  13. 1
      iguana/iguana777.h
  14. 14
      iguana/iguana_exchanges.c
  15. 4
      iguana/iguana_msg.c
  16. 10
      iguana/iguana_notary.c
  17. 4
      iguana/iguana_payments.c
  18. 2
      iguana/main.c
  19. 2
      includes/iguana_apideclares.h

4
basilisk/basilisk.c

@ -209,7 +209,7 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ
}
if ( basilisk_notarycmd(type) != 0 && myinfo->NOTARY.NUMRELAYS == 0 )
{
printf("no notary nodes to send (%s) to\n",type);
//printf("no notary nodes to send (%s) to\n",type);
return(-1);
}
//portable_mutex_lock(&myinfo->allcoins_mutex);
@ -900,6 +900,8 @@ void basilisks_loop(void *arg)
endmilli = startmilli + 1000;
else endmilli = startmilli + 2000;
}
if ( myinfo->expiration != 0 && (myinfo->dexsock >= 0 || myinfo->IAMLP != 0 || myinfo->DEXactive > time(NULL)) )
basilisk_requests_poll(myinfo);
//printf("RELAYID.%d endmilli %f vs now %f\n",myinfo->NOTARY.RELAYID,endmilli,OS_milliseconds());
while ( OS_milliseconds() < endmilli )
usleep(10000);

2
basilisk/basilisk.h

@ -17,7 +17,7 @@
#define H_BASILISK_H
//#define BASILISK_DISABLESENDTX
//#define BASILISK_DISABLEWAITTX
#define BASILISK_DISABLEWAITTX
#include "../iguana/iguana777.h"

77
basilisk/basilisk_DEX.c

@ -34,7 +34,7 @@ int32_t basilisk_ping_processDEX(struct supernet_info *myinfo,uint32_t senderipb
if ( relay->numrequests < relay->maxrequests )
{
memcpy(serialized,&data[len],clen);
//printf("ping processDEX\n");
printf("ping processDEX\n");
n = basilisk_rwDEXquote(0,serialized,&R);
if ( n != clen )
printf("n.%d clen.%d\n",n,clen);
@ -117,15 +117,16 @@ int32_t basilisk_rwDEXquote(int32_t rwflag,uint8_t *serialized,struct basilisk_r
memcpy(rp->dest,&serialized[len],sizeof(rp->dest)), len += sizeof(rp->dest);
}
if ( rp->quoteid != 0 && basilisk_quoteid(rp) != rp->quoteid )
printf("basilisk_rwDEXquote.%d: quoteid.%u mismatch calc %u\n",rwflag,rp->quoteid,basilisk_quoteid(rp));
printf(" basilisk_rwDEXquote.%d: quoteid.%u mismatch calc %u rp.%p\n",rwflag,rp->quoteid,basilisk_quoteid(rp),rp);
if ( basilisk_requestid(rp) != rp->requestid )
printf("basilisk_rwDEXquote.%d: requestid.%u mismatch calc %u\n",rwflag,rp->requestid,basilisk_requestid(rp));
printf(" basilisk_rwDEXquote.%d: requestid.%u mismatch calc %u rp.%p\n",rwflag,rp->requestid,basilisk_requestid(rp),rp);
return(len);
}
uint32_t basilisk_request_enqueue(struct supernet_info *myinfo,struct basilisk_request *rp)
{
uint8_t serialized[256]; int32_t len; struct queueitem *item;
printf(" basilisk_request_enqueue\n");
len = basilisk_rwDEXquote(1,serialized+1,rp);
if ( (item= calloc(1,sizeof(*item) + len + 1)) != 0 )
{
@ -177,7 +178,7 @@ cJSON *basilisk_requestjson(struct basilisk_request *rp)
{
for (i=0; i<sizeof(*rp); i++)
printf("%02x",((uint8_t *)rp)[i]);
printf(" <- rp\n");
printf(" <- rp.%p\n",rp);
for (i=0; i<sizeof(R); i++)
printf("%02x",((uint8_t *)&R)[i]);
printf(" <- R mismatch\n");
@ -216,10 +217,11 @@ int32_t basilisk_request_create(struct basilisk_request *rp,cJSON *valsobj,bits2
//if ( jstr(valsobj,"relay") != 0 )
// rp->relaybits = (uint32_t)calc_ipbits(jstr(valsobj,"relay"));
rp->requestid = basilisk_requestid(rp);
//printf("set requestid <- %u\n",rp->requestid);
if ( rp->destamount != 0 && bits256_nonz(rp->desthash) != 0 )
{
rp->quoteid = basilisk_quoteid(rp);
printf("set quoteid.%u\n",rp->quoteid);
//printf("set quoteid.%u\n",rp->quoteid);
}
//printf("create.%u calc.%u\n",rp->requestid,basilisk_requestid(rp));
return(0);
@ -227,11 +229,13 @@ int32_t basilisk_request_create(struct basilisk_request *rp,cJSON *valsobj,bits2
return(-1);
}
char *basilisk_start(struct supernet_info *myinfo,struct basilisk_request *rp,uint32_t statebits,int32_t optionduration)
char *basilisk_start(struct supernet_info *myinfo,struct basilisk_request *_rp,uint32_t statebits,int32_t optionduration)
{
cJSON *retjson;
if ( (bits256_cmp(rp->srchash,myinfo->myaddr.persistent) == 0 || bits256_cmp(rp->desthash,myinfo->myaddr.persistent) == 0) )
cJSON *retjson; struct basilisk_request *rp;
if ( (bits256_cmp(_rp->srchash,myinfo->myaddr.persistent) == 0 || bits256_cmp(_rp->desthash,myinfo->myaddr.persistent) == 0) )
{
rp = calloc(1,sizeof(*rp));
*rp = *_rp;
printf("START thread to complete %u/%u for (%s %.8f) <-> (%s %.8f) q.%u\n",rp->requestid,rp->quoteid,rp->src,dstr(rp->srcamount),rp->dest,dstr(rp->destamount),rp->quoteid);
if ( basilisk_thread_start(myinfo,rp,statebits,optionduration) != 0 )
{
@ -256,6 +260,7 @@ void basilisk_requests_poll(struct supernet_info *myinfo)
return;
lastpoll = (uint32_t)time(NULL);
memset(&issueR,0,sizeof(issueR));
memset(&myinfo->DEXaccept,0,sizeof(myinfo->DEXaccept));
//printf("Call incoming\n");
if ( (retstr= InstantDEX_incoming(myinfo,0,0,0,0)) != 0 )
{
@ -274,12 +279,22 @@ void basilisk_requests_poll(struct supernet_info *myinfo)
channel = 'D' + ((uint32_t)'E' << 8) + ((uint32_t)'X' << 16);
if ( hwm > 0. )
{
printf("hwm %f\n",hwm);
//printf("hwm %f\n",hwm);
//for (i=0; i<sizeof(issueR); i++)
// printf("%02x",((uint8_t *)&issueR)[i]);
//printf("\n");
myinfo->DEXaccept = issueR;
/*issueR.quoteid = basilisk_quoteid(&issueR);
datalen = basilisk_rwDEXquote(1,data,&issueR);
msgid = (uint32_t)time(NULL);
keylen = basilisk_messagekey(key,0,msgid,issueR.srchash,issueR.desthash);
if ( (retstr= basilisk_respond_addmessage(myinfo,key,keylen,data,datalen,0,BASILISK_DEXDURATION)) != 0 )
free(retstr);*/
if ( bits256_cmp(myinfo->myaddr.persistent,issueR.srchash) == 0 ) // my request
{
printf("my req hwm %f\n",hwm);
if ( (retstr= InstantDEX_accept(myinfo,0,0,0,issueR.requestid,issueR.quoteid)) != 0 )
free(retstr);
printf("my req hwm %f -> %u\n",hwm,issueR.requestid);
basilisk_channelsend(myinfo,issueR.srchash,issueR.desthash,channel,0x4000000,(void *)&issueR.requestid,sizeof(issueR.requestid),60);
numiters = 0;
while ( numiters < 10 && (crc= basilisk_crcsend(myinfo,0,buf,sizeof(buf),issueR.srchash,issueR.desthash,channel,0x4000000,(void *)&issueR.requestid,sizeof(issueR.requestid),crcs)) == 0 )
@ -291,6 +306,7 @@ void basilisk_requests_poll(struct supernet_info *myinfo)
}
if ( crc != 0 )
{
printf("crc.%08x -> basilisk_starta\n",crc);
if ( (retstr= basilisk_start(myinfo,&issueR,1,issueR.optionhours * 3600)) != 0 )
free(retstr);
} else printf("couldnt accept offer\n");
@ -361,15 +377,28 @@ static int _cmp_requests(const void *a,const void *b)
#undef uint32_b
}
struct basilisk_request *_basilisk_requests_uniq(struct supernet_info *myinfo,int32_t *nump,uint8_t *space,int32_t spacesize)
struct basilisk_request *_basilisk_requests_uniq(struct supernet_info *myinfo,int32_t *nump,uint8_t *space,int32_t spacesize,struct basilisk_request *refrp)
{
int32_t i,j,n,k,m; struct basilisk_relay *relay; struct basilisk_request *requests,*rp;
for (j=m=0; j<myinfo->NOTARY.NUMRELAYS; j++)
m = 0;
if ( refrp != 0 )
m = 1;
for (j=0; j<myinfo->NOTARY.NUMRELAYS; j++)
m += myinfo->NOTARY.RELAYS[j].numrequests;
if ( m*sizeof(*requests) <= spacesize )
requests = (void *)space;
else requests = calloc(m,sizeof(*requests));
for (j=m=0; j<myinfo->NOTARY.NUMRELAYS; j++)
if ( refrp != 0 )
{
requests[0] = *refrp;
//for (i=0; i<sizeof(*refrp); i++)
// printf("%02x",((uint8_t *)refrp)[i]);
//printf(" uniq\n");
}
if ( refrp != 0 )
m = 1;
else m = 0;
for (j=0; j<myinfo->NOTARY.NUMRELAYS; j++)
{
relay = &myinfo->NOTARY.RELAYS[j];
if ( (n= relay->numrequests) > 0 )
@ -402,20 +431,22 @@ struct basilisk_request *_basilisk_requests_uniq(struct supernet_info *myinfo,in
return(jprint(retjson,1));
}*/
char *basilisk_respond_requests(struct supernet_info *myinfo,bits256 hash,uint32_t requestid,uint32_t quoteid)
char *basilisk_respond_requests(struct supernet_info *myinfo,bits256 hash,uint32_t requestid,uint32_t quoteid,struct basilisk_request *refrp)
{
int32_t i,qflag,num=0; cJSON *retjson,*array; struct basilisk_request *requests,*rp; uint8_t space[4096];
array = cJSON_CreateArray();
portable_mutex_lock(&myinfo->DEX_reqmutex);
if ( (requests= _basilisk_requests_uniq(myinfo,&num,space,sizeof(space))) != 0 )
if ( (requests= _basilisk_requests_uniq(myinfo,&num,space,sizeof(space),refrp)) != 0 )
{
//printf("numrequests.%d r.%u q.%u\n",num,requestid,quoteid);
for (i=0; i<num; i++)
{
rp = &requests[i];
if ( quoteid == 0 || (quoteid == rp->quoteid && (bits256_cmp(hash,rp->srchash) == 0 || bits256_cmp(hash,rp->desthash) == 0)) )
qflag = 1;
else qflag = 0;
//int32_t j; for (j=0; j<sizeof(*rp); j++)
// printf("%02x",((uint8_t *)rp)[j]);
//printf(" rp[%d] of %d qflag.%d\n",i,num,qflag);
if ( requestid == 0 || (rp->requestid == requestid && qflag != 0) )
jaddi(array,basilisk_requestjson(rp));
}
@ -428,11 +459,11 @@ char *basilisk_respond_requests(struct supernet_info *myinfo,bits256 hash,uint32
return(jprint(retjson,1));
}
char *basilisk_respond_accept(struct supernet_info *myinfo,uint32_t requestid,uint32_t quoteid)
char *basilisk_respond_accept(struct supernet_info *myinfo,uint32_t requestid,uint32_t quoteid,struct basilisk_request *refrp)
{
int32_t i,num=0; char *retstr=0; struct basilisk_request *requests,*rp; uint8_t space[4096];
portable_mutex_lock(&myinfo->DEX_reqmutex);
if ( (requests= _basilisk_requests_uniq(myinfo,&num,space,sizeof(space))) != 0 )
if ( (requests= _basilisk_requests_uniq(myinfo,&num,space,sizeof(space),refrp)) != 0 )
{
for (i=0; i<num; i++)
{
@ -564,8 +595,8 @@ HASH_ARRAY_STRING(InstantDEX,request,hash,vals,hexstr)
if ( (reqjson= basilisk_requestjson(&R)) != 0 )
free_json(reqjson);
datalen = basilisk_rwDEXquote(1,serialized,&R);
int32_t i; for (i=0; i<sizeof(R); i++)
printf("%02x",((uint8_t *)&R)[i]);
//int32_t i; for (i=0; i<sizeof(R); i++)
// printf("%02x",((uint8_t *)&R)[i]);
printf(" R.requestid.%u vs calc %u, q.%u datalen.%d\n",R.requestid,basilisk_requestid(&R),R.quoteid,datalen);
basilisk_rwDEXquote(0,serialized,&R);
} else printf("error creating request\n");
@ -665,9 +696,9 @@ TWO_INTS(InstantDEX,accept,requestid,quoteid)
{
cJSON *vals; char *retstr;
myinfo->DEXactive = (uint32_t)time(NULL) + INSTANTDEX_LOCKTIME;
//if ( myinfo->IAMLP != 0 )
// return(basilisk_respond_accept(myinfo,requestid,quoteid));
//else
if ( myinfo->IAMLP != 0 || myinfo->dexsock >= 0 || myinfo->subsock >= 0 )
return(basilisk_respond_accept(myinfo,requestid,quoteid,&myinfo->DEXaccept));
else
{
vals = cJSON_CreateObject();
jaddnum(vals,"quoteid",(uint32_t)quoteid);

41
basilisk/basilisk_MSG.c

@ -76,7 +76,7 @@ int32_t basilisk_msgcmp(struct basilisk_message *msg,int32_t width,uint32_t chan
{
while ( width >= 0 && n < 60 )
{
if ( msgid == keymsgid && keychannel == channel )
if ( (keymsgid == 0 || msgid == keymsgid) && (keychannel == 0 || keychannel == channel) )
return(0);
msgid--;
n++;
@ -216,9 +216,6 @@ char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int3
msg->expiration = (uint32_t)time(NULL) + duration;
HASH_ADD_KEYPTR(hh,myinfo->messagetable,msg->key,msg->keylen,msg);
QUEUEITEMS++;
//int32_t i; for (i=0; i<BASILISK_KEYSIZE; i++)
// printf("%02x",key[i]);
//printf(" <- ADDMSG.[%d] exp %u %p (%p %p)\n",QUEUEITEMS,msg->expiration,msg,msg->hh.next,msg->hh.prev);
portable_mutex_unlock(&myinfo->messagemutex);
//if ( myinfo->NOTARY.RELAYID >= 0 )
// dpow_handler(myinfo,msg);
@ -277,38 +274,47 @@ HASH_ARRAY_STRING(basilisk,getmessage,hash,vals,hexstr)
jdelete(vals,"msgid");
jaddnum(vals,"msgid",msgid);
}
if ( myinfo->NOTARY.RELAYID >= 0 )
if ( myinfo->NOTARY.RELAYID >= 0 || myinfo->dexsock >= 0 || myinfo->subsock >= 0 )
{
channel = juint(vals,"channel");
width = juint(vals,"width");
retstr = basilisk_iterate_MSG(myinfo,channel,msgid,jbits256(vals,"srchash"),jbits256(vals,"desthash"),width);
//printf("getmessage.(%s)\n",retstr);
return(retstr);
}
//printf("getmessage not relay.%d\n",myinfo->NOTARY.RELAYID);
//printf("getmessage not relay.%d dexsock.%d subsock.%d\n",myinfo->NOTARY.RELAYID,myinfo->dexsock,myinfo->subsock);
return(basilisk_standardservice("MSG",myinfo,0,jbits256(vals,"desthash"),vals,hexstr,1));
}
HASH_ARRAY_STRING(basilisk,sendmessage,hash,vals,hexstr)
{
int32_t keylen,datalen; uint8_t key[BASILISK_KEYSIZE],space[16384],*data,*ptr = 0; char *retstr=0;
data = get_dataptr(BASILISK_HDROFFSET,&ptr,&datalen,&space[BASILISK_KEYSIZE],sizeof(space)-BASILISK_KEYSIZE,hexstr);
if ( myinfo->IAMNOTARY != 0 && myinfo->NOTARY.RELAYID >= 0 )
int32_t keylen,datalen,allocsize = 65536; uint8_t key[BASILISK_KEYSIZE],*space,*space2,*data,*ptr = 0; char *retstr=0;
space = calloc(1,allocsize);
space2 = calloc(1,allocsize);
data = get_dataptr(BASILISK_HDROFFSET,&ptr,&datalen,&space[BASILISK_KEYSIZE],allocsize-BASILISK_KEYSIZE,hexstr);
if ( myinfo->subsock >= 0 || myinfo->dexsock >= 0 || (myinfo->IAMNOTARY != 0 && myinfo->NOTARY.RELAYID >= 0) )
{
keylen = basilisk_messagekey(key,juint(vals,"channel"),juint(vals,"msgid"),jbits256(vals,"srchash"),jbits256(vals,"desthash"));
memcpy(space,key,BASILISK_KEYSIZE);
if ( data != 0 )
{
retstr = basilisk_respond_addmessage(myinfo,key,keylen,data,datalen,0,juint(vals,"duration"));
} else printf("no get_dataptr\n");
if ( ptr != 0 )
free(ptr);
if ( retstr != 0 )
free(retstr);
} else printf("not notary.%d relayid.%d\n",myinfo->IAMNOTARY,myinfo->NOTARY.RELAYID);
} //else printf("not notary.%d relayid.%d\n",myinfo->IAMNOTARY,myinfo->NOTARY.RELAYID);
if ( vals != 0 && juint(vals,"fanout") == 0 )
jaddnum(vals,"fanout",MAX(8,(int32_t)sqrt(myinfo->NOTARY.NUMRELAYS)+2));
if ( data != 0 && datalen != 0 )
dex_reqsend(myinfo,space,datalen+BASILISK_KEYSIZE);
if ( BASILISK_KEYSIZE+datalen < allocsize )
{
memcpy(space2,key,BASILISK_KEYSIZE);
if ( data != 0 && datalen != 0 )
memcpy(&space2[BASILISK_KEYSIZE],data,datalen);
dex_reqsend(myinfo,"DEX",space2,datalen+BASILISK_KEYSIZE);
} else printf("sendmessage space too small error for %d\n",datalen);
free(space);
free(space2);
if ( ptr != 0 )
free(ptr);
return(basilisk_standardservice("OUT",myinfo,0,jbits256(vals,"desthash"),vals,hexstr,0));
}
#include "../includes/iguana_apiundefs.h"
@ -440,7 +446,7 @@ uint32_t basilisk_majority32(int32_t *datalenp,uint32_t rawcrcs[64],int32_t data
{
for (i=0; i<numcrcs; i++)
{
printf("%08x ",rawcrcs[i]);
//printf("%08x ",rawcrcs[i]);
for (j=0; j<numcandidates; j++)
{
if ( rawcrcs[i] == candidates[j] && datalens[i] == candlens[j] )
@ -457,7 +463,7 @@ uint32_t basilisk_majority32(int32_t *datalenp,uint32_t rawcrcs[64],int32_t data
numcandidates++;
}
}
printf("n.%d -> numcandidates.%d\n",i,numcandidates);
//printf("n.%d -> numcandidates.%d\n",i,numcandidates);
if ( numcandidates > 0 )
{
for (j=0; j<numcandidates; j++)
@ -516,7 +522,6 @@ uint32_t basilisk_crcrecv(struct supernet_info *myinfo,int32_t width,uint8_t *ve
} else printf("not keystr.%p or no data.%p or bad datalen.%d\n",keystr,hexstr,datalen);
}
}
printf("(%s).%d ",jprint(item,0),i);
}
//printf("n.%d maxlen.%d\n",n,maxlen);
}

42
basilisk/basilisk_bitcoin.c

@ -882,7 +882,7 @@ cJSON *BTC_makeclaimfunc(struct supernet_info *myinfo,struct exchange_info *exch
HASH_ARRAY_STRING(basilisk,value,hash,vals,hexstr)
{
char *retstr=0,*symbol,*coinaddr; cJSON *retjson,*txoutjson; uint32_t basilisktag,blocktime; bits256 txid,blockhash; struct basilisk_item *ptr,Lptr; uint64_t value; int32_t timeoutmillis,vout,height;
char *retstr=0,*symbol,*coinaddr; cJSON *retjson,*txoutjson,*txjson,*array; uint32_t basilisktag,blocktime; bits256 txid,blockhash; struct basilisk_item *ptr,Lptr; uint64_t value; int32_t timeoutmillis,vout,height,n;
if ( vals == 0 )
return(clonestr("{\"error\":\"null valsobj\"}"));
//if ( myinfo->IAMNOTARY != 0 || myinfo->NOTARY.RELAYID >= 0 )
@ -894,12 +894,12 @@ HASH_ARRAY_STRING(basilisk,value,hash,vals,hexstr)
}
if ( jobj(vals,"fanout") == 0 )
jaddnum(vals,"fanout",MAX(5,(int32_t)sqrt(myinfo->NOTARY.NUMRELAYS)+1));
txid = jbits256(vals,"txid");
vout = jint(vals,"vout");
if ( coin != 0 )
{
if ( coin->FULLNODE < 0 )
{
txid = jbits256(vals,"txid");
vout = jint(vals,"vout");
if ( (txoutjson= dpow_gettxout(myinfo,coin,txid,vout)) != 0 )
{
if ( (coinaddr= jstr(txoutjson,"address")) != 0 && (value= SATOSHIDEN*jdouble(txoutjson,"value")) != 0 )
@ -936,6 +936,42 @@ HASH_ARRAY_STRING(basilisk,value,hash,vals,hexstr)
return(retstr);
}
}
if ( myinfo->reqsock >= 0 )
{
if ( coin != 0 && (retstr= dex_getrawtransaction(myinfo,coin->symbol,txid)) != 0 )
{
if ( (txoutjson= cJSON_Parse(retstr)) != 0 )
{
printf("TX.(%s)\n",jprint(txoutjson,0));
retjson = cJSON_CreateObject();
jaddstr(retjson,"result","success");
if ( (array= jarray(&n,txoutjson,"vout")) != 0 && vout < n && (txjson= jitem(array,vout)) != 0 )
{
printf("txjson.(%s)\n",jprint(txjson,0));
if ( (coinaddr= jstr(txoutjson,"address")) != 0 && (value= j64bits(txjson,"value") * SATOSHIDEN) != 0 )
{
jaddstr(retjson,"address",coinaddr);
jadd64bits(retjson,"satoshis",value);
jaddnum(retjson,"value",dstr(value));
//height = dpow_getchaintip(myinfo,&blockhash,&blocktime,0,0,coin);
//jaddnum(retjson,"height",height);
jaddnum(retjson,"numconfirms",jint(txjson,"confirmations"));
jaddbits256(retjson,"txid",txid);
jaddnum(retjson,"vout",vout);
jaddstr(retjson,"coin",coin->symbol);
free(retstr);
free_json(txoutjson);
return(jprint(retjson,1));
}
}
jaddnum(retjson,"numconfirms",0);
free_json(txoutjson);
return(jprint(retjson,1));
}
return(retstr);
}
}
return(basilisk_standardservice("VAL",myinfo,0,hash,vals,hexstr,1));
}

57
basilisk/basilisk_swap.c

@ -257,7 +257,7 @@ int32_t basilisk_numconfirms(struct supernet_info *myinfo,struct basilisk_rawtx
jaddstr(argjson,"coin",rawtx->coin->symbol);
if ( (valstr= basilisk_value(myinfo,rawtx->coin,0,0,myinfo->myaddr.persistent,argjson,0)) != 0 )
{
//char str[65]; printf("%s %s valstr.(%s)\n",rawtx->name,bits256_str(str,rawtx->actualtxid),valstr);
//char str[65]; printf("%s %s valstr.(%s)\n",rawtx->name,bits256_str(str,rawtx->I.actualtxid),valstr);
if ( (valuearray= cJSON_Parse(valstr)) != 0 )
{
if ( is_cJSON_Array(valuearray) != 0 )
@ -866,11 +866,11 @@ int32_t basilisk_swapget(struct supernet_info *myinfo,struct basilisk_swap *swap
uint32_t basilisk_swapsend(struct supernet_info *myinfo,struct basilisk_swap *swap,uint32_t msgbits,uint8_t *data,int32_t datalen,uint32_t nextbits,uint32_t crcs[2])
{
//if ( (rand() % 10) == 0 )
basilisk_channelsend(myinfo,swap->I.myhash,swap->I.otherhash,swap->I.req.quoteid,msgbits,data,datalen,INSTANTDEX_LOCKTIME*2);
if ( basilisk_crcsend(myinfo,0,swap->verifybuf,sizeof(swap->verifybuf),swap->I.myhash,swap->I.otherhash,swap->I.req.quoteid,msgbits,data,datalen,crcs) != 0 )
return(nextbits);
//if ( basilisk_channelsend(myinfo,swap->I.myhash,swap->I.otherhash,swap->I.req.quoteid,msgbits,data,datalen,INSTANTDEX_LOCKTIME*2) == 0 )
// return(nextbits);
//printf("ERROR basilisk_channelsend\n");
basilisk_channelsend(myinfo,swap->I.myhash,swap->I.otherhash,swap->I.req.quoteid,msgbits,data,datalen,INSTANTDEX_LOCKTIME*2);
return(0);
}
@ -1064,7 +1064,7 @@ struct basilisk_swap *bitcoin_swapinit(struct supernet_info *myinfo,struct basil
{
swap->bobcoin = iguana_coinfind("BTC");
swap->I.bobsatoshis = swap->I.req.srcamount;
swap->I.bobconfirms = (1 + sqrt(dstr(swap->I.bobsatoshis) * .1));
swap->I.bobconfirms = (1*0 + sqrt(dstr(swap->I.bobsatoshis) * .1));
swap->alicecoin = iguana_coinfind(swap->I.req.dest);
swap->I.alicesatoshis = swap->I.req.destamount;
swap->I.aliceconfirms = swap->I.bobconfirms * 3;
@ -1073,7 +1073,7 @@ struct basilisk_swap *bitcoin_swapinit(struct supernet_info *myinfo,struct basil
{
swap->bobcoin = iguana_coinfind("BTC");
swap->I.bobsatoshis = swap->I.req.destamount;
swap->I.bobconfirms = (1 + sqrt(dstr(swap->I.bobsatoshis) * .1));
swap->I.bobconfirms = (1*0 + sqrt(dstr(swap->I.bobsatoshis) * .1));
swap->alicecoin = iguana_coinfind(swap->I.req.src);
swap->I.alicesatoshis = swap->I.req.srcamount;
swap->I.aliceconfirms = swap->I.bobconfirms * 3;
@ -1505,7 +1505,7 @@ int32_t basilisk_swapiteration(struct supernet_info *myinfo,struct basilisk_swap
basilisk_swapget(myinfo,swap,0x80000000,data,maxlen,basilisk_verify_otherstatebits);
if ( (swap->I.otherstatebits & 0x80) != 0 && (swap->I.statebits & 0x80) != 0 )
break;
sleep(1);//3 + (swap->iambob == 0)*10);
sleep(3 + (swap->I.iambob == 0)*1);
basilisk_swapget(myinfo,swap,0x80000000,data,maxlen,basilisk_verify_otherstatebits);
basilisk_sendstate(myinfo,swap,data,maxlen);
if ( (swap->I.otherstatebits & 0x80) == 0 )
@ -1688,7 +1688,7 @@ int32_t basilisk_swapiteration(struct supernet_info *myinfo,struct basilisk_swap
}
if ( (rand() % 30) == 0 )
printf("finished swapstate.%x other.%x\n",swap->I.statebits,swap->I.otherstatebits);
sleep(1);//3 + (swap->iambob == 0));
sleep(3 + (swap->I.iambob == 0));
basilisk_sendstate(myinfo,swap,data,maxlen);
basilisk_swapget(myinfo,swap,0x80000000,data,maxlen,basilisk_verify_otherstatebits);
}
@ -1697,16 +1697,18 @@ int32_t basilisk_swapiteration(struct supernet_info *myinfo,struct basilisk_swap
void basilisk_swaploop(void *_swap)
{
uint8_t *data; uint32_t expiration; int32_t retval=0,i,j,datalen,maxlen; struct supernet_info *myinfo; struct basilisk_swap *swap = _swap;
uint8_t *data; uint32_t expiration; uint32_t channel; int32_t retval=0,i,j,datalen,maxlen; struct supernet_info *myinfo; struct basilisk_swap *swap = _swap;
myinfo = swap->myinfo;
fprintf(stderr,"start swap\n");
maxlen = 1024*1024 + sizeof(*swap);
data = malloc(maxlen);
expiration = (uint32_t)time(NULL) + 600;
myinfo->DEXactive = expiration;
channel = 'D' + ((uint32_t)'E' << 8) + ((uint32_t)'X' << 16);
while ( (swap->I.statebits & (0x08|0x02)) != (0x08|0x02) && time(NULL) < expiration )
{
printf("A r%u/q%u swapstate.%x\n",swap->I.req.requestid,swap->I.req.quoteid,swap->I.statebits);
basilisk_channelsend(myinfo,swap->I.req.srchash,swap->I.req.desthash,channel,0x4000000,(void *)&swap->I.req.requestid,sizeof(swap->I.req.requestid),60);
basilisk_sendstate(myinfo,swap,data,maxlen);
basilisk_sendpubkeys(myinfo,swap,data,maxlen); // send pubkeys
if ( basilisk_checkdeck(myinfo,swap,data,maxlen) == 0) // check for other deck 0x02
@ -1715,17 +1717,23 @@ void basilisk_swaploop(void *_swap)
if ( (swap->I.statebits & (0x08|0x02)) == (0x08|0x02) )
break;
sleep(1);
//dpow_nanomsg_update(myinfo);
//dex_updateclient(myinfo);
}
while ( (swap->I.statebits & 0x20) == 0 && time(NULL) < expiration )
{
printf("B r%u/q%u swapstate.%x\n",swap->I.req.requestid,swap->I.req.quoteid,swap->I.statebits);
basilisk_sendstate(myinfo,swap,data,maxlen);
basilisk_sendchoosei(myinfo,swap,data,maxlen);
basilisk_sendmostprivs(myinfo,swap,data,maxlen);
if ( basilisk_swapget(myinfo,swap,0x20,data,maxlen,basilisk_verify_privkeys) == 0 )
{
swap->I.statebits |= 0x20;
break;
}
sleep(1);//3 + (swap->iambob == 0)*10);
sleep(3 + (swap->I.iambob == 0)*1);
//dpow_nanomsg_update(myinfo);
//dex_updateclient(myinfo);
}
if ( time(NULL) >= expiration )
retval = -1;
@ -1733,6 +1741,8 @@ void basilisk_swaploop(void *_swap)
printf("C r%u/q%u swapstate.%x\n",swap->I.req.requestid,swap->I.req.quoteid,swap->I.statebits);
while ( retval == 0 && (swap->I.statebits & 0x40) == 0 ) // send fee
{
//dpow_nanomsg_update(myinfo);
//dex_updateclient(myinfo);
basilisk_sendstate(myinfo,swap,data,maxlen);
basilisk_swapget(myinfo,swap,0x80000000,data,maxlen,basilisk_verify_otherstatebits);
if ( swap->myfee.txbytes == 0 )
@ -1789,7 +1799,9 @@ void basilisk_swaploop(void *_swap)
else
{
retval = 0;
printf("ALICE PAYMENT created\n");
for (i=0; i<swap->alicepayment.I.spendlen; i++)
printf("%02x",swap->alicepayment.txbytes[i]);
printf(" ALICE PAYMENT created\n");
iguana_unspents_mark(myinfo,swap->alicecoin,swap->alicepayment.vins);
basilisk_txlog(myinfo,swap,&swap->alicepayment,-1);
break;
@ -1801,6 +1813,12 @@ void basilisk_swaploop(void *_swap)
swap->I.statebits |= basilisk_swapdata_rawtxsend(myinfo,swap,0x80,data,maxlen,&swap->myfee,0x40);
iguana_unspents_mark(myinfo,swap->I.iambob!=0?swap->bobcoin:swap->alicecoin,swap->myfee.vins);
basilisk_txlog(myinfo,swap,&swap->myfee,-1);
for (i=0; i<swap->myfee.I.spendlen; i++)
printf("%02x",swap->myfee.txbytes[i]);
printf(" alice fee %p %x\n",swap->myfee.txbytes,swap->I.statebits);
swap->I.statebits |= 0x40;
if ( swap->alicepayment.txbytes != 0 && swap->alicepayment.I.spendlen > 0 )
break;
}
else
{
@ -1811,11 +1829,13 @@ void basilisk_swaploop(void *_swap)
}
while ( basilisk_swapiteration(myinfo,swap,data,maxlen) == 0 )
{
sleep(1);
sleep(3);
basilisk_sendstate(myinfo,swap,data,maxlen);
basilisk_swapget(myinfo,swap,0x80000000,data,maxlen,basilisk_verify_otherstatebits);
if ( time(NULL) > swap->I.expiration )
break;
//dpow_nanomsg_update(myinfo);
//dex_updateclient(myinfo);
}
printf("end of atomic swap\n");
if ( swap->I.iambob != 0 && swap->bobdeposit.txbytes != 0 )
@ -1855,16 +1875,17 @@ struct basilisk_swap *basilisk_thread_start(struct supernet_info *myinfo,struct
vcalc_sha256(0,swap->I.orderhash.bytes,(uint8_t *)rp,sizeof(*rp));
swap->I.req = *rp;
swap->myinfo = myinfo;
printf("START swap requestid.%u\n",rp->requestid);
m = n = 0;
if ( bitcoin_swapinit(myinfo,swap,optionduration) != 0 )
{
starttime = (uint32_t)time(NULL);
while ( statebits == 0 && m <= n/2 && time(NULL) < starttime+300 )
while ( statebits == 0 && m <= n/2 && time(NULL) < starttime+30 )
{
m = n = 0;
printf("waiting for offer to be accepted\n");
dpow_nanomsg_update(myinfo);
dex_updateclient(myinfo);
sleep(3);
printf("waiting for offer to be accepted\n");
channel = 'D' + ((uint32_t)'E' << 8) + ((uint32_t)'X' << 16);
if ( (retarray= basilisk_channelget(myinfo,rp->srchash,rp->desthash,channel,0x4000000,30)) != 0 )
{
@ -1879,14 +1900,16 @@ struct basilisk_swap *basilisk_thread_start(struct supernet_info *myinfo,struct
if ( jobj(item,"data") != 0 && jobj(item,"key") != 0 )
m++;
else printf("(%s)\n",jprint(item,0));
} else printf("msgobj.%p m.%d n.%d\n",msgobj,m,n);
} //else printf("msgobj.%p m.%d n.%d\n",msgobj,m,n);
}
}
} else printf("no retarray\n");
}
if ( statebits != 0 || m > n/2 )
{
fprintf(stderr,"m.%d n.%d launch.%d %d\n",m,n,myinfo->numswaps,(int32_t)(sizeof(myinfo->swaps)/sizeof(*myinfo->swaps)));
//for (i=0; i<sizeof(swap->I.req); i++)
// fprintf(stderr,"%02x",((uint8_t *)&swap->I.req)[i]);
//fprintf(stderr," M.%d N.%d launch.%d %d %p\n",m,n,myinfo->numswaps,(int32_t)(sizeof(myinfo->swaps)/sizeof(*myinfo->swaps)),&swap->I.req);
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)basilisk_swaploop,(void *)swap) != 0 )
{

13
basilisk/basilisk_tradebot.c

@ -410,7 +410,7 @@ double basilisk_request_listprocess(struct supernet_info *myinfo,struct basilisk
}
} else noquoteflag++;
}
//printf("%s -> %s myrequest.%d pendingid.%u noquoteflag.%d havequoteflag.%d maxi.%d %.8f\n",list[0].src,list[0].dest,myrequest,pendingid,noquoteflag,havequoteflag,maxi,dstr(maxamount));
printf("%s -> %s myrequest.%d pendingid.%u noquoteflag.%d havequoteflag.%d maxi.%d %.8f\n",list[0].src,list[0].dest,myrequest,pendingid,noquoteflag,havequoteflag,maxi,dstr(maxamount));
double retvals[4],refprice,profitmargin,aveprice; cJSON *retjson; char *retstr;
if ( myinfo->IAMLP != 0 && myrequest == 0 && pendingid == 0 && noquoteflag != 0 && (profitmargin= tradebot_liquidity_active(myinfo,&refprice,list[0].src,list[0].dest)) > 0. )
{
@ -447,8 +447,10 @@ double basilisk_request_listprocess(struct supernet_info *myinfo,struct basilisk
{
if ( minamount != 0 && maxamount > minamount && time(NULL) > BASILISK_DEXDURATION/2 )
{
printf("automatch quoteid.%u triggered %.8f > %.8f\n",list[maxi].quoteid,dstr(maxamount),dstr(minamount));
*issueR = list[maxi];
for (i=0; i<sizeof(*issueR); i++)
printf("%02x",((uint8_t *)issueR)[i]);
printf(" automatch[%d] quoteid.%u triggered %.8f > %.8f\n",maxi,list[maxi].quoteid,dstr(maxamount),dstr(minamount));
if ( minamount > 0 )
metric = (dstr(maxamount) / dstr(minamount)) - 1.;
else metric = 1.;
@ -489,6 +491,7 @@ double basilisk_process_results(struct supernet_info *myinfo,struct basilisk_req
*issueR = tmpR;
hwm = metric;
refR = tmpR;
printf("SET HWM\n");
}
m = 0;
}
@ -504,7 +507,13 @@ double basilisk_process_results(struct supernet_info *myinfo,struct basilisk_req
//printf("process_results n.%d m.%d nonz.%d\n",n,m,nonz);
if ( m > 0 && m < sizeof(list)/sizeof(*list) )
if ( (metric= basilisk_request_listprocess(myinfo,&tmpR,list,m)) > hwm )
{
*issueR = tmpR, hwm = metric;
printf("set hwm\n");
for (i=0; i<sizeof(*issueR); i++)
printf("%02x",((uint8_t *)issueR)[i]);
printf("\n");
}
}
return(hwm);
}

9
iguana/dPoW.h

@ -22,7 +22,7 @@
#define DPOW_MINSIGS 11
//#define DPOW_M(bp) ((bp)->minsigs) // (((bp)->numnotaries >> 1) + 1)
#define DPOW_MODIND(bp,offset) (((((bp)->height / DPOW_CHECKPOINTFREQ) % (bp)->numnotaries) + (offset)) % (bp)->numnotaries)
#define DPOW_VERSION 0x0776
#define DPOW_VERSION 0x0777
#define DPOW_UTXOSIZE 10000
#define DPOW_MINOUTPUT 6000
#define DPOW_DURATION 600
@ -45,7 +45,7 @@
#define DPOW_MAXRELAYS 64
#define DPOW_MAXSIGLEN 128
#define DEX_VERSION 0x0102
#define DEX_VERSION 0x0103
#define DPOW_SOCK 7775
#define DEX_SOCK 7774
#define PUB_SOCK 7773
@ -141,11 +141,14 @@ struct dpow_info
uint64_t dpow_notarybestk(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp);
int32_t dpow_paxpending(uint8_t *hex,uint32_t *paxwdcrcp);
void dex_updateclient(struct supernet_info *myinfo);
int32_t dex_reqsend(struct supernet_info *myinfo,uint8_t *data,int32_t datalen);
char *dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32_t datalen);
char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int32_t keylen,uint8_t *data,int32_t datalen,int32_t sendping,uint32_t duration);
char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *signedtx);
cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout);
int32_t dpow_getchaintip(struct supernet_info *myinfo,bits256 *blockhashp,uint32_t *blocktimep,bits256 *txs,uint32_t *numtxp,struct iguana_info *coin);
void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,bits256 srchash,bits256 desthash,uint32_t channel,uint32_t msgbits,uint8_t *data,int32_t datalen);
int32_t dpow_nanomsg_update(struct supernet_info *myinfo);
char *dex_getrawtransaction(struct supernet_info *myinfo,char *symbol,bits256 txid);
cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid);
#endif

2
iguana/dpow/dpow_fsm.c

@ -412,7 +412,7 @@ void dpow_statemachinestart(void *ptr)
extralen = dpow_paxpending(extras,&bp->paxwdcrc);
bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc;
}
sleep(1);
sleep(3);
if ( dp->checkpoint.blockhash.height > checkpoint.blockhash.height )
{
if ( bp->isratify == 0 )

162
iguana/dpow/dpow_network.c

@ -19,6 +19,7 @@
struct dex_nanomsghdr
{
uint32_t crc32,size,datalen,timestamp;
char handler[8];
uint8_t version0,version1,packet[];
} PACKED;
@ -56,10 +57,10 @@ static int _increasing_ipbits(const void *a,const void *b)
void dex_packet(struct supernet_info *myinfo,struct dex_nanomsghdr *dexp,int32_t size)
{
char *retstr; int32_t i;
for (i=0; i<size; i++)
printf("%02x",((uint8_t *)dexp)[i]);
printf(" uniq DEX_PACKET.[%d] crc.%x lag.%d (%d %d)\n",size,calc_crc32(0,(void *)((long)dexp+sizeof(dexp->crc32)),(int32_t)(size-sizeof(dexp->crc32))),(int32_t)(time(NULL)-dexp->timestamp),dexp->size,dexp->datalen);
char *retstr;
//for (i=0; i<size; i++)
// printf("%02x",((uint8_t *)dexp)[i]);
//printf(" uniq DEX_PACKET.[%d] crc.%x lag.%d (%d %d)\n",size,calc_crc32(0,dexp->packet,dexp->datalen),(int32_t)(time(NULL)-dexp->timestamp),dexp->size,dexp->datalen);
if ( dexp->datalen > BASILISK_KEYSIZE )
{
if ( (retstr= basilisk_respond_addmessage(myinfo,dexp->packet,BASILISK_KEYSIZE,&dexp->packet[BASILISK_KEYSIZE],dexp->datalen-BASILISK_KEYSIZE,0,BASILISK_DEXDURATION)) != 0 )
@ -67,9 +68,49 @@ void dex_packet(struct supernet_info *myinfo,struct dex_nanomsghdr *dexp,int32_t
}
}
int32_t dex_reqsend(struct supernet_info *myinfo,uint8_t *data,int32_t datalen)
struct dex_request { bits256 txid; char name[15]; uint8_t func; };
int32_t dex_rwrequest(int32_t rwflag,uint8_t *serialized,struct dex_request *dexreq)
{
int32_t len = 0;
len += iguana_rwbignum(rwflag,&serialized[len],sizeof(dexreq->txid),dexreq->txid.bytes);
if ( rwflag != 0 )
{
memcpy(&serialized[len],dexreq->name,sizeof(dexreq->name)), len += sizeof(dexreq->name);
serialized[len++] = dexreq->func;
}
else
{
memcpy(dexreq->name,&serialized[len],sizeof(dexreq->name)), len += sizeof(dexreq->name);
dexreq->func = serialized[len++];
}
return(len);
}
char *dex_response(struct supernet_info *myinfo,struct dex_nanomsghdr *dexp)
{
struct dex_nanomsghdr *dexp; char ipaddr[64],str[128]; int32_t retval=0,timeout,i,n,size,recvbytes,sentbytes = 0,reqsock,subsock; uint32_t *retptr,ipbits;
char *retstr = 0; cJSON *retjson; struct iguana_info *coin; struct dex_request dexreq;
if ( strcmp(dexp->handler,"request") == 0 )
{
dex_rwrequest(0,dexp->packet,&dexreq);
if ( (coin= iguana_coinfind(dexreq.name)) != 0 )
{
printf("dex_response.%s (%c)\n",dexreq.name,dexreq.func);
if ( dexreq.func == 'T' )
{
if ( (retjson= dpow_gettransaction(myinfo,coin,dexreq.txid)) != 0 )
retstr = jprint(retjson,1);
}
}
if ( retstr == 0 )
return(clonestr("{\"error\":\"null return\"}"));
}
return(retstr);
}
char *dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32_t datalen)
{
struct dex_nanomsghdr *dexp; char ipaddr[64],str[128]; int32_t timeout,i,n,size,recvbytes,sentbytes = 0,reqsock,subsock; uint32_t *retptr,ipbits; char *retstr = 0;
portable_mutex_lock(&myinfo->dexmutex);
subsock = myinfo->subsock;
reqsock = myinfo->reqsock;
@ -115,54 +156,74 @@ int32_t dex_reqsend(struct supernet_info *myinfo,uint8_t *data,int32_t datalen)
{
size = (int32_t)(sizeof(*dexp) + datalen);
dexp = calloc(1,size); // endian dependent!
safecopy(dexp->handler,handler,sizeof(dexp->handler));
dexp->size = size;
dexp->datalen = datalen;
dexp->timestamp = (uint32_t)time(NULL);
dexp->version0 = DEX_VERSION & 0xff;
dexp->version1 = (DEX_VERSION >> 8) & 0xff;
memcpy(dexp->packet,data,datalen);
dexp->crc32 = calc_crc32(0,(void *)((long)dexp+sizeof(dexp->crc32)),(int32_t)(size-sizeof(dexp->crc32)));
dexp->crc32 = calc_crc32(0,data,datalen);
sentbytes = nn_send(myinfo->reqsock,dexp,size,0);
for (i=0; i<size; i++)
printf("%02x",((uint8_t *)dexp)[i]);
printf(" sent.%d:%d\n",sentbytes,size);
//for (i=0; i<datalen; i++)
// printf("%02x",((uint8_t *)data)[i]);
//printf(" sent.%d:%d datalen.%d\n",sentbytes,size,datalen);
if ( (recvbytes= nn_recv(myinfo->reqsock,&retptr,NN_MSG,0)) >= 0 )
{
ipbits = *retptr;
expand_ipbits(ipaddr,ipbits);
printf("req returned.[%d] %08x %s\n",recvbytes,*retptr,ipaddr);
portable_mutex_lock(&myinfo->dexmutex);
n = myinfo->numdexipbits;
for (i=0; i<n; i++)
if ( ipbits == myinfo->dexipbits[i] )
break;
if ( i == n && n < 64 )
if ( strcmp(handler,"DEX") == 0 )
{
myinfo->dexipbits[n++] = ipbits;
qsort(myinfo->dexipbits,n,sizeof(uint32_t),_increasing_ipbits);
if ( (myinfo->numdexipbits= n) < 3 )
ipbits = *retptr;
expand_ipbits(ipaddr,ipbits);
//printf("req returned.[%d] %08x %s\n",recvbytes,*retptr,ipaddr);
n = myinfo->numdexipbits;
for (i=0; i<n; i++)
if ( ipbits == myinfo->dexipbits[i] )
break;
if ( i == n && n < 64 )
{
if ( myinfo->IAMNOTARY == 0 && myinfo->subsock >= 0 )
myinfo->dexipbits[n++] = ipbits;
qsort(myinfo->dexipbits,n,sizeof(uint32_t),_increasing_ipbits);
if ( (myinfo->numdexipbits= n) < 3 )
{
nn_connect(myinfo->subsock,nanomsg_tcpname(0,str,ipaddr,PUB_SOCK));
printf("%d: subscribe connect (%s)\n",myinfo->numdexipbits,str);
if ( myinfo->IAMNOTARY == 0 && myinfo->subsock >= 0 )
{
nn_connect(myinfo->subsock,nanomsg_tcpname(0,str,ipaddr,PUB_SOCK));
printf("%d: subscribe connect (%s)\n",myinfo->numdexipbits,str);
}
}
nn_connect(myinfo->reqsock,nanomsg_tcpname(0,str,ipaddr,REP_SOCK));
printf("%d: req connect (%s)\n",myinfo->numdexipbits,str);
}
nn_connect(myinfo->reqsock,nanomsg_tcpname(0,str,ipaddr,REP_SOCK));
printf("%d: req connect (%s)\n",myinfo->numdexipbits,str);
}
portable_mutex_unlock(&myinfo->dexmutex);
else
{
retstr = clonestr((char *)retptr);
printf("REQ got.%d (%s)\n",recvbytes,retstr);
}
nn_freemsg(retptr);
portable_mutex_unlock(&myinfo->dexmutex);
}
else
{
retval = -2;
//retval = -2;
//printf("no rep return? recvbytes.%d\n",recvbytes);
}
printf("DEXREQ.[%d] crc32.%08x datalen.%d sent.%d recv.%d timestamp.%u\n",size,dexp->crc32,datalen,sentbytes,recvbytes,dexp->timestamp);
//printf("DEXREQ.[%d] crc32.%08x datalen.%d sent.%d recv.%d timestamp.%u\n",size,dexp->crc32,datalen,sentbytes,recvbytes,dexp->timestamp);
free(dexp);
} else retval = -1;
return(retval);
} //else retval = -1;
return(retstr);
}
char *dex_getrawtransaction(struct supernet_info *myinfo,char *symbol,bits256 txid)
{
struct dex_request dexreq; uint8_t packet[sizeof(dexreq)]; int32_t datalen;
memset(&dexreq,0,sizeof(dexreq));
safecopy(dexreq.name,symbol,sizeof(dexreq.name));
dexreq.txid = txid;
dexreq.func = 'T';
datalen = dex_rwrequest(1,packet,&dexreq);
return(dex_reqsend(myinfo,"request",packet,datalen));
}
int32_t dex_crc32find(struct supernet_info *myinfo,uint32_t crc32)
@ -191,7 +252,7 @@ int32_t dex_packetcheck(struct supernet_info *myinfo,struct dex_nanomsghdr *dexp
{
if ( dexp->datalen == (size - sizeof(*dexp)) )
{
crc32 = calc_crc32(0,(void *)((long)dexp + sizeof(dexp->crc32)),(int32_t)(size - sizeof(dexp->crc32)));
crc32 = calc_crc32(0,dexp->packet,dexp->datalen);//(void *)((long)dexp + sizeof(dexp->crc32)),(int32_t)(size - sizeof(dexp->crc32)));
if ( dexp->crc32 == crc32 && (firstz= dex_crc32find(myinfo,crc32)) >= 0 )
return(0);
}
@ -204,9 +265,10 @@ int32_t dex_subsock_poll(struct supernet_info *myinfo)
int32_t size= -1; struct dex_nanomsghdr *dexp;
if ( myinfo->subsock >= 0 && (size= nn_recv(myinfo->subsock,&dexp,NN_MSG,0)) >= 0 )
{
//printf("SUBSOCK.%08x recv.%d datalen.%d\n",dexp->crc32,size,dexp->datalen);
if ( dex_packetcheck(myinfo,dexp,size) == 0 )
{
printf("SUBSOCK.%08x ",dexp->crc32);
//printf("SUBSOCK.%08x ",dexp->crc32);
dex_packet(myinfo,dexp,size);
}
if ( dexp != 0 )
@ -934,8 +996,8 @@ void dpow_ipbitsadd(struct supernet_info *myinfo,struct dpow_info *dp,uint32_t *
int32_t dpow_nanomsg_update(struct supernet_info *myinfo)
{
int32_t i,n=0,num=0,size,firstz = -1; uint32_t crc32,r,m; struct dpow_nanomsghdr *np=0; struct dpow_info *dp; struct dpow_block *bp; struct dex_nanomsghdr *dexp = 0;
if ( time(NULL) < myinfo->nanoinit+5 || myinfo->dpowsock < 0 )
int32_t i,n=0,num=0,size,firstz = -1; char *retstr; uint32_t crc32,r,m; struct dpow_nanomsghdr *np=0; struct dpow_info *dp; struct dpow_block *bp; struct dex_nanomsghdr *dexp = 0;
if ( time(NULL) < myinfo->nanoinit+5 || (myinfo->dpowsock < 0 && myinfo->dexsock < 0 && myinfo->repsock < 0) )
return(-1);
portable_mutex_lock(&myinfo->dpowmutex);
for (i=0; i<100; i++)
@ -1005,7 +1067,7 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo)
num++;
if ( dex_packetcheck(myinfo,dexp,size) == 0 )
{
printf("FROM BUS.%08x -> pub\n",dexp->crc32);
//printf("FROM BUS.%08x -> pub\n",dexp->crc32);
nn_send(myinfo->pubsock,dexp,size,0);
dex_packet(myinfo,dexp,size);
}
@ -1019,18 +1081,26 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo)
if ( (size= nn_recv(myinfo->repsock,&dexp,NN_MSG,0)) >= 0 )
{
num++;
if ( (m= myinfo->numdpowipbits) > 0 )
if ( (retstr= dex_response(myinfo,dexp)) != 0 )
{
r = myinfo->dpowipbits[rand() % m];
nn_send(myinfo->repsock,&r,sizeof(r),0);
printf("REP.%08x <- rand ip m.%d %x\n",dexp->crc32,m,r);
} else printf("illegal state without dpowipbits?\n");
if ( dex_packetcheck(myinfo,dexp,size) == 0 )
nn_send(myinfo->repsock,retstr,(int32_t)strlen(retstr)+1,0);
free(retstr);
}
else
{
nn_send(myinfo->dexsock,dexp,size,0);
nn_send(myinfo->pubsock,dexp,size,0);
printf("REP.%08x -> dexbus and pub, t.%d lag.%d\n",dexp->crc32,dexp->timestamp,(int32_t)(time(NULL)-dexp->timestamp));
dex_packet(myinfo,dexp,size);
if ( (m= myinfo->numdpowipbits) > 0 )
{
r = myinfo->dpowipbits[rand() % m];
nn_send(myinfo->repsock,&r,sizeof(r),0);
//printf("REP.%08x <- rand ip m.%d %x\n",dexp->crc32,m,r);
} else printf("illegal state without dpowipbits?\n");
if ( dex_packetcheck(myinfo,dexp,size) == 0 )
{
nn_send(myinfo->dexsock,dexp,size,0);
nn_send(myinfo->pubsock,dexp,size,0);
//printf("REP.%08x -> dexbus and pub, t.%d lag.%d\n",dexp->crc32,dexp->timestamp,(int32_t)(time(NULL)-dexp->timestamp));
dex_packet(myinfo,dexp,size);
}
}
//printf("GOT DEX rep PACKET.%d\n",size);
if ( dexp != 0 )

52
iguana/dpowassets

@ -0,0 +1,52 @@
#!/bin/bash
set -x
source pubkey.txt
echo $pubkey
curl --url "http://127.0.0.1:7776" --data "{\"timeout\":60000,\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"REVS\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SUPERNET\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"DEX\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PANGEA\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"JUMBLR\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BET\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CRYPTO\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HODL\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SHARK\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BOTS\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MGW\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"USD\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"EUR\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"JPY\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"GBP\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"AUD\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CAD\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CHF\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"NZD\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CNY\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"RUB\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MXN\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BRL\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"INR\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HKD\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"TRY\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ZAR\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PLN\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"NOK\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SEK\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"DKK\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CZK\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HUF\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ILS\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KRW\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MYR\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PHP\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"RON\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SGD\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"THB\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BGN\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"IDR\",\"pubkey\":\"$pubkey\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HRK\",\"pubkey\":\"$pubkey\"}"

4
iguana/iguana777.c

@ -893,11 +893,11 @@ void iguana_coinloop(void *arg)
{
if ( coin->FULLNODE < 0 )
continue;
if ( strcmp(coin->symbol,"RELAY") == 0 )
/*if ( strcmp(coin->symbol,"RELAY") == 0 )
{
if ( myinfo->expiration != 0 && (myinfo->IAMLP != 0 || myinfo->DEXactive > now) )
basilisk_requests_poll(myinfo);
}
}*/
if ( n > 1 && coin->RTheight > 0 && (rand() % 10) != 0 )
continue;
if ( coin->peers == 0 )

1
iguana/iguana777.h

@ -107,6 +107,7 @@ struct supernet_info
struct basilisk_message *messagetable; portable_mutex_t messagemutex; queue_t msgQ,p2pQ;
void *ctx;
uint8_t *pingbuf;
struct basilisk_request DEXaccept;
FILE *dexfp;
struct dpow_info DPOWS[64]; int32_t numdpows,dpowsock,dexsock,pubsock,repsock,subsock,reqsock;
struct delayedPoW_info dPoW;

14
iguana/iguana_exchanges.c

@ -22,7 +22,7 @@
//char *Exchange_names[] = { "poloniex", "bittrex", "btc38", "huobi", "bitstamp", "bitfinex", "btce", "coinbase", "okcoin", "lakebtc", "quadriga", "truefx", "ecb", "instaforex", "fxcm", "yahoo" };
int32_t instantdex_updatesources(struct exchange_info *exchange,struct exchange_quote *sortbuf,int32_t n,int32_t max,int32_t ind,int32_t dir,struct exchange_quote *quotes,int32_t numquotes,double offset)
int32_t instantdex_updatesources(struct exchange_info *exchange,struct exchange_quote *sortbuf,int32_t n,int32_t max,int32_t ind,int32_t dir,struct exchange_quote *quotes,int32_t numquotes,double offset,double factor)
{
int32_t i; struct exchange_quote *quote;
//printf("instantdex_updatesources.%s update dir.%d numquotes.%d offset %.6f\n",exchange->name,dir,numquotes,offset);
@ -33,6 +33,8 @@ int32_t instantdex_updatesources(struct exchange_info *exchange,struct exchange_
{
//printf("%s n.%d ind.%d i.%d dir.%d price %.8f vol %.8f offset %.6f\n",exchange->name,n,ind,i,dir,quote->price+offset,quote->volume,offset);
quote->price += offset;
quote->price /= factor;
quote->volume *= factor;
quote->satoshis = quote->price * SATOSHIDEN;
sortbuf[n] = *quote;
sortbuf[n].val = ind;
@ -47,7 +49,7 @@ int32_t instantdex_updatesources(struct exchange_info *exchange,struct exchange_
double instantdex_aveprice(struct supernet_info *myinfo,struct exchange_quote *sortbuf,int32_t max,double *totalvolp,char *base,char *rel,double basevolume,cJSON *argjson)
{
char *str; double totalvol,pricesum,hblas[64][2],refbid,refask; uint32_t timestamp;
char *str; double totalvol,pricesum,hblas[64][2],refbid,refask,factor = 1.; uint32_t timestamp;
struct exchange_quote quote; int32_t i,n,dir,num,depth = 100;
struct exchange_info *exchange; struct exchange_request *req,*active[64];
if ( myinfo == 0 )
@ -66,6 +68,10 @@ double instantdex_aveprice(struct supernet_info *myinfo,struct exchange_quote *s
memset(sortbuf,0,sizeof(*sortbuf) * max);
if ( base != 0 && rel != 0 && basevolume > SMALLVAL )
{
if ( strcmp(base,"KMD") == 0 )
base = "BTCD", factor = 50;
else if ( strcmp(rel,"KMD") == 0 )
rel = "BTCD", factor = 0.02;
for (i=num=0; i<myinfo->numexchanges && num < sizeof(active)/sizeof(*active); i++)
{
if ( (exchange= myinfo->tradingexchanges[i]) != 0 )
@ -117,9 +123,9 @@ double instantdex_aveprice(struct supernet_info *myinfo,struct exchange_quote *s
for (i=n=0; i<num; i++)
{
if ( dir < 0 && active[i]->numbids > 0 )
n = instantdex_updatesources(active[i]->exchange,sortbuf,n,max,i,1,active[i]->bidasks,active[i]->numbids,hblas[i][0]);
n = instantdex_updatesources(active[i]->exchange,sortbuf,n,max,i,1,active[i]->bidasks,active[i]->numbids,hblas[i][0],factor);
else if ( dir > 0 && active[i]->numasks > 0 )
n = instantdex_updatesources(active[i]->exchange,sortbuf,n,max,i,-1,&active[i]->bidasks[1],active[i]->numasks,hblas[i][1]);
n = instantdex_updatesources(active[i]->exchange,sortbuf,n,max,i,-1,&active[i]->bidasks[1],active[i]->numasks,hblas[i][1],factor);
}
//printf("numexchanges.%d dir.%d %s/%s numX.%d n.%d\n",myinfo->numexchanges,dir,base,rel,num,n);
if ( dir < 0 )

4
iguana/iguana_msg.c

@ -325,7 +325,7 @@ int32_t iguana_rwmsgalert(struct iguana_info *coin,int32_t rwflag,uint8_t *seria
printf("%02x",coin->chain->alertpubkey[i]);
char str[65]; printf(" alertpubkey.%d, alerthash2.%s\n",plen,bits256_str(str,alerthash2));
} else msg->siglen = 0;
printf(" ALERT v.%d relay.%lld expires.%lld ID.%d cancel.%d numlist.%d minver.%d maxver.%d subver.(%s) priority.%d comment.(%s) STATUS.(%s) reserved.(%s)\n",msg->version,(long long)msg->relayuntil,(long long)msg->expiration,msg->ID,msg->cancel,msg->numcancellist,msg->minver,msg->maxver,msg->subver,msg->priority,msg->comment,msg->statusbar,msg->reserved);
//printf(" ALERT v.%d relay.%lld expires.%lld ID.%d cancel.%d numlist.%d minver.%d maxver.%d subver.(%s) priority.%d comment.(%s) STATUS.(%s) reserved.(%s)\n",msg->version,(long long)msg->relayuntil,(long long)msg->expiration,msg->ID,msg->cancel,msg->numcancellist,msg->minver,msg->maxver,msg->subver,msg->priority,msg->comment,msg->statusbar,msg->reserved);
return(len);
}
@ -1251,7 +1251,7 @@ int32_t iguana_msgparser(struct supernet_info *myinfo,struct iguana_info *coin,s
//printf("error.(%s) (%s): len.%d != recvlen.%d\n",H->command,addr->ipaddr,len,recvlen);
//for (i=0; i<len; i++)
// printf("%02x",data[i]);
if ( len != 0 && strcmp(H->command,"addr") != 0 && (coin->chain->auxpow == 0 || strcmp(H->command,"headers") != 0) )
if ( len != 0 && strcmp(H->command,"addr") != 0 && (coin->chain->auxpow == 0 || strcmp(H->command,"headers") != 0) && strcmp(H->command,"alert") != 0 )
printf("%s %s.%s len mismatch %d != %d\n",coin->symbol,addr!=0?addr->ipaddr:"local",H->command,len,recvlen);
}
else if ( len != recvlen && recvlen > 1 )

10
iguana/iguana_notary.c

@ -345,16 +345,18 @@ THREE_STRINGS(iguana,passthru,asset,function,hex)
}
STRING_ARG(dex,send,hex)
TWO_STRINGS(dex,send,hex,handler)
{
uint8_t data[8192]; int32_t datalen,retval;
uint8_t data[8192]; int32_t datalen; char *retstr;
if ( hex != 0 && (datalen= is_hexstr(hex,0)) > 0 && (datalen>>1) < sizeof(data) )
{
datalen >>= 1;
decode_hex(data,datalen,hex);
if ( (retval= dex_reqsend(myinfo,data,datalen)) == 0 )
if ( handler == 0 || handler[0] == 0 )
handler = "DEX";
if ( (retstr= dex_reqsend(myinfo,handler,data,datalen)) == 0 )
return(clonestr("{\"result\":\"success\"}"));
else return(clonestr("{\"error\":\"dex send: retval error\"}"));
else return(retstr);
} else return(clonestr("{\"error\":\"dex send: invalid hex\"}"));
}

4
iguana/iguana_payments.c

@ -172,7 +172,7 @@ int32_t iguana_RTbestunspent(struct supernet_info *myinfo,struct iguana_info *co
continue;
if ( iguana_RTunspent_check(myinfo,coin,unspents[i]) != 0 )
{
printf("(%d u%d) %.8f already used\n",unspents[i].hdrsi,unspents[i].unspentind,dstr(atx_value));
//printf("(%d u%d) %.8f already used\n",unspents[i].hdrsi,unspents[i].unspentind,dstr(atx_value));
continue;
}
if ( maxmode == 0 )
@ -1256,7 +1256,7 @@ cJSON *iguana_listunspents(struct supernet_info *myinfo,struct iguana_info *coin
{
array = iguana_getaddressesbyaccount(myinfo,coin,"*");
flag = 1;
printf("listunspent.(%s)\n",jprint(array,0));
//printf("listunspent.(%s)\n",jprint(array,0));
}
if ( minconf == 0 )
minconf = 1;

2
iguana/main.c

@ -1621,7 +1621,7 @@ void iguana_main(void *arg)
#if LIQUIDITY_PROVIDER
myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bitcoin"),0);
myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("poloniex"),0);
myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bittrex"),0);
//myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bittrex"),0);
myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("btc38"),0);
myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("huobi"),0);
myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("coinbase"),0);

2
includes/iguana_apideclares.h

@ -20,7 +20,7 @@ TWOINTS_AND_ARRAY(dpow,ratify,minsigs,timestamp,ratified);
ZERO_ARGS(dpow,cancelratify);
THREE_STRINGS(iguana,passthru,asset,function,hex);
STRING_ARG(dpow,bindaddr,ipaddr);
STRING_ARG(dex,send,hex);
TWO_STRINGS(dex,send,hex,handler);
TWO_STRINGS(zcash,passthru,function,hex);
TWO_STRINGS(komodo,passthru,function,hex);

Loading…
Cancel
Save