diff --git a/iguana/Makefile b/iguana/Makefile index c6c016bad..fab2a8511 100755 --- a/iguana/Makefile +++ b/iguana/Makefile @@ -26,7 +26,7 @@ DEPS = nacl_io #LIBS = crypto777 curl ssl crypto z pthread ppapi nacl_io #DEPS = nacl_io #LIBS = crypto777 curl ssl crypto z glibc-compat nacl_spawn ppapi nacl_io ppapi_simple # cli_main ppapi_cpp ppapi_simple -LIBS = crypto777 z glibc-compat nacl_spawn ppapi nacl_io ppapi_simple +LIBS = crypto777 z glibc-compat nacl_spawn ppapi nacl_io #ppapi_simple CFLAGS = -Wall -O2 -fno-strict-aliasing $(EXTRA) LFLAGS = libs diff --git a/iguana/SuperNET.c b/iguana/SuperNET.c index e63317c5e..5bbac4d47 100755 --- a/iguana/SuperNET.c +++ b/iguana/SuperNET.c @@ -1397,7 +1397,7 @@ struct supernet_info *SuperNET_accountfind(cJSON *json) SuperNET_setkeys(&M,0,0,0); if ( (myinfo = SuperNET_MYINFOfind(&num,M.myaddr.persistent)) != 0 ) { - printf("found account.(%s) %s %llu\n",myinfo!=0?myinfo->handle:"",M.myaddr.NXTADDR,(long long)M.myaddr.nxt64bits); + //printf("found account.(%s) %s %llu\n",myinfo!=0?myinfo->handle:"",M.myaddr.NXTADDR,(long long)M.myaddr.nxt64bits); return(myinfo); } } @@ -1406,7 +1406,7 @@ struct supernet_info *SuperNET_accountfind(cJSON *json) SuperNET_setkeys(&M,passphrase,(int32_t)strlen(passphrase),1); if ( (myinfo= SuperNET_MYINFOfind(&num,M.myaddr.persistent)) != 0 ) { - printf("found account.(%s) %s %llu\n",myinfo!=0?myinfo->handle:"",M.myaddr.NXTADDR,(long long)M.myaddr.nxt64bits); + //printf("found account.(%s) %s %llu\n",myinfo!=0?myinfo->handle:"",M.myaddr.NXTADDR,(long long)M.myaddr.nxt64bits); return(myinfo); } } else printf("no passphrase in (%s)\n",jprint(json,0)); diff --git a/iguana/SuperNET_keys.c b/iguana/SuperNET_keys.c index 94e8dcad9..68d9ed82b 100755 --- a/iguana/SuperNET_keys.c +++ b/iguana/SuperNET_keys.c @@ -207,7 +207,7 @@ cJSON *SuperNET_decryptedjson(char *destfname,char *passphrase,int32_t passsize, wallethash = SuperNET_linehash(passphrase); SuperNET_linehash(fname2fa); // maps special chars wallet2priv = SuperNET_wallet2priv(fname2fa,wallethash); - char str[65],str2[65]; printf("(%s + %s) -> wallethash.%s 2.(%s)\n",passphrase,fname2fa,bits256_str(str,wallethash),bits256_str(str2,wallet2priv)); + //char str[65],str2[65]; printf("(%s + %s) -> wallethash.%s 2.(%s)\n",passphrase,fname2fa,bits256_str(str,wallethash),bits256_str(str2,wallet2priv)); } first = (bits256_nonz(wallethash) != 0 && bits256_cmp(wallethash,GENESIS_PRIVKEY) != 0); second = (bits256_nonz(wallet2priv) != 0 && bits256_cmp(wallet2priv,GENESIS_PRIVKEY) != 0); @@ -218,7 +218,7 @@ cJSON *SuperNET_decryptedjson(char *destfname,char *passphrase,int32_t passsize, wallet2shared = SuperNET_wallet2shared(wallethash,wallet2priv); wallet2pub = curve25519(wallet2shared,curve25519_basepoint9()); sprintf(destfname,"confs/%s",bits256_str(str,wallet2pub)); - printf("fname.(%s) wallet2pub.%s < [%s, %s]\n",destfname,bits256_str(str,wallet2pub),passphrase,fname2fa); + //printf("fname.(%s) wallet2pub.%s < [%s, %s]\n",destfname,bits256_str(str,wallet2pub),passphrase,fname2fa); if ( (confstr= OS_filestr(&allocsize,destfname)) != 0 ) { if ( (filejson= cJSON_Parse(confstr)) != 0 ) diff --git a/iguana/exchanges777.h b/iguana/exchanges777.h index fcd799e33..353cfa8a4 100755 --- a/iguana/exchanges777.h +++ b/iguana/exchanges777.h @@ -34,7 +34,7 @@ #define INSTANTDEX_BTCD "RThtXup6Zo7LZAi8kRWgjAyi1s4u6U9Cpf" #define INSTANTDEX_MINPERC 50. -#define INSTANTDEX_OFFERDURATION 300 +#define INSTANTDEX_OFFERDURATION 1800 #define INSTANTDEX_LOCKTIME 3600 #define EXCHANGES777_MINPOLLGAP 1 @@ -108,7 +108,7 @@ struct exchange_request struct instantdex_offer { char base[24],rel[24]; - int64_t price64,basevolume64; uint64_t offer64; + int64_t price64,basevolume64; uint64_t account; uint32_t expiration,nonce; char myside,acceptdir,minperc,pad; }; diff --git a/iguana/iguana_accept.c b/iguana/iguana_accept.c index a2e5c762b..916450e78 100755 --- a/iguana/iguana_accept.c +++ b/iguana/iguana_accept.c @@ -188,14 +188,14 @@ int32_t iguana_process_msgrequestQ(struct supernet_info *myinfo,struct iguana_in flag = 1; if ( msg->addr != 0 ) { - char str[65]; printf("send type.%d %s -> (%s)\n",msg->type,bits256_str(str,msg->hash2),msg->addr->ipaddr); + //char str[65]; printf("send type.%d %s -> (%s)\n",msg->type,bits256_str(str,msg->hash2),msg->addr->ipaddr); if ( msg->type == MSG_BLOCK ) { if ( coin->RELAYNODE != 0 || coin->VALIDATENODE != 0 ) { if ( (addr= msg->addr) != 0 && (len= iguana_peerblockrequest(coin,&coin->blockspace[sizeof(struct iguana_msghdr)],(int32_t)(sizeof(coin->blockspace) - sizeof(struct iguana_msghdr)),0,msg->hash2,0)) > 0 ) { - printf("msg Sendlen.%d block %s to %s\n",len,bits256_str(str,msg->hash2),addr->ipaddr); + char str[65]; printf("msg Sendlen.%d block %s to %s\n",len,bits256_str(str,msg->hash2),addr->ipaddr); iguana_queue_send(coin,addr,0,coin->blockspace,"block",len,0,0); } } diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 81288e36f..36e14baf7 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -1410,8 +1410,8 @@ void iguana_bundlestats(struct iguana_info *coin,char *str,int32_t lag) static FILE *logfp; if ( logfp == 0 ) logfp = fopen("debug.log","wb"); - //if ( logfp != 0 ) - printf("%s bQ.%d %d:%02d:%02d stuck.%d max.%d\n",str,queue_size(&bundlesQ),(int32_t)difft.x/3600,(int32_t)(difft.x/60)%60,(int32_t)difft.x%60,coin->stucktime!=0?(uint32_t)time(NULL) - coin->stucktime:0,coin->maxstuck); + if ( logfp != 0 ) + fprintf(logfp,"%s bQ.%d %d:%02d:%02d stuck.%d max.%d\n",str,queue_size(&bundlesQ),(int32_t)difft.x/3600,(int32_t)(difft.x/60)%60,(int32_t)difft.x%60,coin->stucktime!=0?(uint32_t)time(NULL) - coin->stucktime:0,coin->maxstuck); strcpy(coin->lastdispstr,str); //if ( (rand() % 100) == 0 ) // myallocated(0,0); diff --git a/iguana/iguana_instantdex.c b/iguana/iguana_instantdex.c index 3d1dca335..0b030cf52 100755 --- a/iguana/iguana_instantdex.c +++ b/iguana/iguana_instantdex.c @@ -291,7 +291,7 @@ bits256 instantdex_rwoffer(int32_t rwflag,int32_t *lenp,uint8_t *serialized,stru len += iguana_rwstr(rwflag,&serialized[len],sizeof(offer->rel),offer->rel); len += iguana_rwnum(rwflag,&serialized[len],sizeof(offer->price64),&offer->price64); len += iguana_rwnum(rwflag,&serialized[len],sizeof(offer->basevolume64),&offer->basevolume64); - len += iguana_rwnum(rwflag,&serialized[len],sizeof(offer->offer64),&offer->offer64); + len += iguana_rwnum(rwflag,&serialized[len],sizeof(offer->account),&offer->account); len += iguana_rwnum(rwflag,&serialized[len],sizeof(offer->expiration),&offer->expiration); len += iguana_rwnum(rwflag,&serialized[len],sizeof(offer->nonce),&offer->nonce); len += iguana_rwnum(rwflag,&serialized[len],sizeof(offer->myside),&offer->myside); @@ -510,7 +510,7 @@ cJSON *instantdex_offerjson(struct instantdex_offer *offer,uint64_t orderid) { int32_t dir; cJSON *item = cJSON_CreateObject(); jadd64bits(item,"orderid",orderid); - jadd64bits(item,"offerer",offer->offer64); + jadd64bits(item,"account",offer->account); if ( (dir= instantdex_bidaskdir(offer)) > 0 ) jaddstr(item,"type","bid"); else if ( dir < 0 ) @@ -706,7 +706,7 @@ struct instantdex_accept *instantdex_offerfind(struct supernet_info *ignore,stru { if ( now < ap->offer.expiration && ap->dead == 0 ) { - //printf("%d %d find cmps %d %d %d %d %d %d me.%llu vs %llu o.%llu | vs %llu\n",instantdex_bidaskdir(&ap->offer),ap->offer.expiration-now,strcmp(base,"*") == 0,strcmp(base,ap->offer.base) == 0,strcmp(rel,"*") == 0,strcmp(rel,ap->offer.rel) == 0,orderid == 0,orderid == ap->orderid,(long long)myinfo->myaddr.nxt64bits,(long long)ap->offer.offer64,(long long)ap->orderid,(long long)orderid); + //printf("%d %d find cmps %d %d %d %d %d %d me.%llu vs %llu o.%llu | vs %llu\n",instantdex_bidaskdir(&ap->offer),ap->offer.expiration-now,strcmp(base,"*") == 0,strcmp(base,ap->offer.base) == 0,strcmp(rel,"*") == 0,strcmp(rel,ap->offer.rel) == 0,orderid == 0,orderid == ap->orderid,(long long)myinfo->myaddr.nxt64bits,(long long)ap->offer.account,(long long)ap->orderid,(long long)orderid); if ( (report == 0 || ap->reported == 0) && (strcmp(base,"*") == 0 || strcmp(base,ap->offer.base) == 0) && (strcmp(rel,"*") == 0 || strcmp(rel,ap->offer.rel) == 0) && (orderid == 0 || orderid == ap->orderid) ) { if ( report != 0 && ap->reported == 0 ) @@ -781,7 +781,7 @@ uint64_t instantdex_basebits(char *base) else return(stringbits(base)); } -uint64_t instantdex_decodehash(char *base,char *rel,int64_t *pricep,uint64_t *offererp,bits256 encodedhash) +uint64_t instantdex_decodehash(char *base,char *rel,int64_t *pricep,uint64_t *accountp,bits256 encodedhash) { int32_t i; uint64_t offerid; base[4] = rel[4] = 0; @@ -791,12 +791,12 @@ uint64_t instantdex_decodehash(char *base,char *rel,int64_t *pricep,uint64_t *of rel[i] = encodedhash.bytes[12 + i]; } iguana_rwnum(0,(void *)&encodedhash.ulongs[2],sizeof(uint64_t),pricep); - iguana_rwnum(0,(void *)&encodedhash.ulongs[3],sizeof(uint64_t),offererp); + iguana_rwnum(0,(void *)&encodedhash.ulongs[3],sizeof(uint64_t),accountp); iguana_rwnum(0,(void *)&encodedhash.ulongs[0],sizeof(uint64_t),&offerid); return(encodedhash.ulongs[0]); } -bits256 instantdex_encodehash(char *base,char *rel,int64_t price,uint64_t orderid,uint64_t offerer) +bits256 instantdex_encodehash(char *base,char *rel,int64_t price,uint64_t orderid,uint64_t account) { bits256 encodedhash; int32_t i; char _base[4],_rel[4]; iguana_rwnum(1,(void *)&encodedhash.ulongs[0],sizeof(uint64_t),&orderid); @@ -810,7 +810,7 @@ bits256 instantdex_encodehash(char *base,char *rel,int64_t price,uint64_t orderi encodedhash.bytes[12 + i] = _rel[i]; } iguana_rwnum(1,(void *)&encodedhash.ulongs[2],sizeof(uint64_t),&price); - iguana_rwnum(1,(void *)&encodedhash.ulongs[3],sizeof(uint64_t),&offerer); + iguana_rwnum(1,(void *)&encodedhash.ulongs[3],sizeof(uint64_t),&account); return(encodedhash); } @@ -829,7 +829,7 @@ int32_t instantdex_inv2data(struct supernet_info *myinfo,struct iguana_info *coi { if ( n < sizeof(hashes)/sizeof(*hashes) )//&& GETBIT(ap->peerhas,addr->addrind) == 0 ) { - hashes[n++] = instantdex_encodehash(ap->offer.base,ap->offer.rel,ap->offer.price64*instantdex_bidaskdir(&ap->offer),ap->orderid,ap->offer.offer64); + hashes[n++] = instantdex_encodehash(ap->offer.base,ap->offer.rel,ap->offer.price64*instantdex_bidaskdir(&ap->offer),ap->orderid,ap->offer.account); printf("%llu ",(long long)ap->orderid); } queue_enqueue("acceptableQ",&exchange->acceptableQ,&ap->DL,0); @@ -846,9 +846,9 @@ int32_t instantdex_inv2data(struct supernet_info *myinfo,struct iguana_info *coi struct instantdex_accept *instantdex_quotefind(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,bits256 encodedhash) { - char base[9],rel[9]; int64_t pricetoshis; uint64_t orderid,offer64; - orderid = instantdex_decodehash(base,rel,&pricetoshis,&offer64,encodedhash); - //printf("search for orderid.%llu (%s/%s) %.8f from %llu\n",(long long)orderid,base,rel,dstr(pricetoshis),(long long)offer64); + char base[9],rel[9]; int64_t pricetoshis; uint64_t orderid,account; + orderid = instantdex_decodehash(base,rel,&pricetoshis,&account,encodedhash); + //printf("search for orderid.%llu (%s/%s) %.8f from %llu\n",(long long)orderid,base,rel,dstr(pricetoshis),(long long)account); return(instantdex_offerfind(myinfo,exchanges777_find("bitcoin"),0,0,orderid,base,rel,1,0)); } @@ -899,7 +899,7 @@ int32_t instantdex_quotep2p(struct supernet_info *myinfo,struct iguana_info *coi orderhash = instantdex_rwoffer(0,&checklen,serialized,&A.offer), A.orderid = orderhash.txid; if ( checklen == recvlen ) { - encodedhash = instantdex_encodehash(A.offer.base,A.offer.rel,A.offer.price64 * instantdex_bidaskdir(&A.offer),A.orderid,A.offer.offer64); + encodedhash = instantdex_encodehash(A.offer.base,A.offer.rel,A.offer.price64 * instantdex_bidaskdir(&A.offer),A.orderid,A.offer.account); if ( (ap= instantdex_quotefind(myinfo,coin,addr,encodedhash)) == 0 ) { //printf("add quote here!\n"); @@ -954,34 +954,34 @@ struct instantdex_accept *instantdex_acceptable(struct supernet_info *myinfo,str queue_enqueue("acceptableQ",&exchange->acceptableQ,&PAD.DL,0); offerdir = instantdex_bidaskdir(&A->offer); minvol = (A->offer.basevolume64 * minperc * .01); - printf("instantdex_acceptable offerdir.%d (%s/%s) minperc %.3f minvol %.8f vs %.8f\n",offerdir,A->offer.base,A->offer.rel,minperc,dstr(minvol),dstr(A->offer.basevolume64)); + printf("instantdex_acceptable.%d offerdir.%d (%s/%s) minperc %.3f minvol %.8f vs %.8f\n",queue_size(&exchange->acceptableQ),offerdir,A->offer.base,A->offer.rel,minperc,dstr(minvol),dstr(A->offer.basevolume64)); while ( (ap= queue_dequeue(&exchange->acceptableQ,0)) != 0 && ap != &PAD ) { - if ( now > ap->offer.expiration || ap->dead != 0 || A->offer.offer64 == ap->offer.offer64 ) + if ( now > ap->offer.expiration || ap->dead != 0 || A->offer.account == ap->offer.account ) { - //printf("now.%u skip expired %u/dead.%u or my order orderid.%llu from %llu\n",now,ap->offer.expiration,ap->dead,(long long)ap->orderid,(long long)ap->offer.offer64); + //printf("now.%u skip expired %u/dead.%u or my order orderid.%llu from %llu\n",now,ap->offer.expiration,ap->dead,(long long)ap->orderid,(long long)ap->offer.account); } else if ( strcmp(ap->offer.base,A->offer.base) != 0 || strcmp(ap->offer.rel,A->offer.rel) != 0 ) { - //printf("skip mismatched.(%s/%s) orderid.%llu from %llu\n",ap->offer.base,ap->offer.rel,(long long)ap->orderid,(long long)ap->offer.offer64); + //printf("skip mismatched.(%s/%s) orderid.%llu from %llu\n",ap->offer.base,ap->offer.rel,(long long)ap->orderid,(long long)ap->offer.account); } else if ( offerdir*instantdex_bidaskdir(&ap->offer) > 0 ) { - //printf("skip same direction %d orderid.%llu from %llu\n",instantdex_bidaskdir(&ap->offer),(long long)ap->orderid,(long long)ap->offer.offer64); + //printf("skip same direction %d orderid.%llu from %llu\n",instantdex_bidaskdir(&ap->offer),(long long)ap->orderid,(long long)ap->offer.account); } else if ( minvol > ap->offer.basevolume64 - ap->pendingvolume64 ) { - //printf("skip too small order %.8f vs %.8f orderid.%llu from %llu\n",dstr(minvol),dstr(ap->offer.basevolume64)-dstr(ap->pendingvolume64),(long long)ap->orderid,(long long)ap->offer.offer64); + //printf("skip too small order %.8f vs %.8f orderid.%llu from %llu\n",dstr(minvol),dstr(ap->offer.basevolume64)-dstr(ap->pendingvolume64),(long long)ap->orderid,(long long)ap->offer.account); } else if ( (offerdir > 0 && ap->offer.price64 > A->offer.price64) || (offerdir < 0 && ap->offer.price64 < A->offer.price64) ) { - //printf("skip out of band dir.%d offer %.8f vs %.8f orderid.%llu from %llu\n",offerdir,dstr(ap->offer.price64),dstr(A->offer.price64),(long long)ap->orderid,(long long)ap->offer.offer64); + //printf("skip out of band dir.%d offer %.8f vs %.8f orderid.%llu from %llu\n",offerdir,dstr(ap->offer.price64),dstr(A->offer.price64),(long long)ap->orderid,(long long)ap->offer.account); } else { if ( bestprice64 == 0 || (offerdir > 0 && ap->offer.price64 < bestprice64) || (offerdir < 0 && ap->offer.price64 > bestprice64) ) { - printf(">>>> MATCHED better price dir.%d offer %.8f vs %.8f orderid.%llu from %llu\n",offerdir,dstr(ap->offer.price64),dstr(A->offer.price64),(long long)ap->orderid,(long long)ap->offer.offer64); + printf(">>>> MATCHED better price dir.%d offer %.8f vs %.8f orderid.%llu from %llu\n",offerdir,dstr(ap->offer.price64),dstr(A->offer.price64),(long long)ap->orderid,(long long)ap->offer.account); bestprice64 = ap->offer.price64; if ( retap != 0 ) queue_enqueue("acceptableQ",&exchange->acceptableQ,&retap->DL,0); @@ -1007,7 +1007,7 @@ struct instantdex_accept *instantdex_acceptable(struct supernet_info *myinfo,str // NXT node verifies bitcoin txbytes has proper payment and cashes in with onetimepubkey // BTC* node approves phased tx with onetimepubkey -bits256 instantdex_acceptset(struct instantdex_accept *ap,char *base,char *rel,int32_t duration,int32_t myside,int32_t acceptdir,double price,double volume,uint64_t offerbits,uint32_t nonce,uint8_t minperc) +bits256 instantdex_acceptset(struct instantdex_accept *ap,char *base,char *rel,int32_t duration,int32_t myside,int32_t acceptdir,double price,double volume,uint64_t account,uint32_t nonce,uint8_t minperc) { bits256 hash; memset(ap,0,sizeof(*ap)); @@ -1019,7 +1019,7 @@ bits256 instantdex_acceptset(struct instantdex_accept *ap,char *base,char *rel,i if ( duration < 1000000000 ) ap->offer.expiration = (uint32_t)time(NULL) + duration; else ap->offer.expiration = duration; - ap->offer.offer64 = offerbits; + ap->offer.account = account; ap->offer.myside = myside; ap->offer.acceptdir = acceptdir; ap->offer.minperc = minperc; @@ -1071,7 +1071,7 @@ int32_t instantdex_acceptextract(struct instantdex_accept *ap,cJSON *argjson) ap->offer.expiration = juint(argjson,"e"); ap->offer.myside = juint(argjson,"s"); ap->offer.acceptdir = jint(argjson,"d"); - ap->offer.offer64 = j64bits(argjson,"o"); + ap->offer.account = j64bits(argjson,"o"); ap->offer.price64 = j64bits(argjson,"p"); ap->offer.basevolume64 = j64bits(argjson,"v"); if ( (ap->offer.minperc= juint(argjson,"m")) < INSTANTDEX_MINPERC ) @@ -1145,7 +1145,7 @@ char *instantdex_checkoffer(struct supernet_info *myinfo,uint64_t *txidp,struct *txidp = myap->orderid; if ( (otherap= instantdex_acceptable(myinfo,exchange,myap,myap->offer.minperc)) == 0 ) { - printf("instantdex_checkoffer add.%llu to acceptableQ\n",(long long)myap->orderid); + printf("instantdex_checkoffer add.%llu from.%llu to acceptableQ\n",(long long)myap->orderid,(long long)myap->offer.account); //if ( (retstr= instantdex_sendcmd(myinfo,&myap->offer,argjson,"BTCoffer",GENESIS_PUBKEY,INSTANTDEX_HOPS,0,0,1)) != 0 ) // free(retstr); queue_enqueue("acceptableQ",&exchange->acceptableQ,&myap->DL,0); @@ -1234,7 +1234,7 @@ char *instantdex_parse(struct supernet_info *myinfo,struct instantdex_msghdr *ms } A.offer = *offer; A.orderid = orderhash.txid; - printf("got.(%s) for %llu offer64.%llu serdatalen.%d\n",cmdstr,(long long)A.orderid,(long long)A.offer.offer64,serdatalen); + printf("got.(%s) for %llu account.%llu serdatalen.%d\n",cmdstr,(long long)A.orderid,(long long)A.offer.account,serdatalen); if ( (A.offer.minperc= jdouble(argjson,"p")) < INSTANTDEX_MINPERC ) A.offer.minperc = INSTANTDEX_MINPERC; else if ( A.offer.minperc > 100 ) @@ -1360,7 +1360,7 @@ char *InstantDEX_hexmsg(struct supernet_info *myinfo,struct category_info *cat,v return(retstr); } -char *instantdex_createaccept(struct supernet_info *myinfo,struct instantdex_accept **aptrp,struct exchange_info *exchange,char *base,char *rel,double price,double basevolume,int32_t acceptdir,char *mysidestr,int32_t duration,uint64_t offerer,int32_t queueflag,uint8_t minperc) +char *instantdex_createaccept(struct supernet_info *myinfo,struct instantdex_accept **aptrp,struct exchange_info *exchange,char *base,char *rel,double price,double basevolume,int32_t acceptdir,char *mysidestr,int32_t duration,uint64_t account,int32_t queueflag,uint8_t minperc) { struct instantdex_accept *ap; int32_t myside; char *retstr; *aptrp = 0; @@ -1376,7 +1376,7 @@ char *instantdex_createaccept(struct supernet_info *myinfo,struct instantdex_acc myside = -1; printf("myside.(%s) != base.%s or rel.%s\n",mysidestr,base,rel); } - instantdex_acceptset(ap,base,rel,duration,myside,acceptdir,price,basevolume,offerer,0,minperc); + instantdex_acceptset(ap,base,rel,duration,myside,acceptdir,price,basevolume,account,0,minperc); instantdex_propagate(myinfo,exchange,ap); if ( queueflag != 0 ) { @@ -1509,7 +1509,7 @@ cJSON *instantdex_reportjson(cJSON *item,char *name) jadd(newjson,name,jduplicate(jobj(item,"price"))); jadd(newjson,"volume",jduplicate(jobj(item,"volume"))); jadd(newjson,"orderid",jduplicate(jobj(item,"orderid"))); - jadd(newjson,"account",jduplicate(jobj(item,"offerer"))); + jadd(newjson,"account",jduplicate(jobj(item,"account"))); jaddnum(newjson,"date",dateval); jaddnum(newjson,"s",dateval % 60); jaddnum(newjson,"m",(dateval / 60) % 60); diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index d0eb9b27f..26905d426 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -319,8 +319,8 @@ uint32_t iguana_ramchain_addunspent20(struct iguana_info *coin,struct iguana_pee if ( addr != 0 && addr->voutsfp != 0 ) { #ifdef __PNACL__ - static portable_mutex_t mutex; - portable_mutex_lock(&mutex); + //static portable_mutex_t mutex; + //portable_mutex_lock(&mutex); #endif u->fileid = (uint32_t)addr->addrind; scriptpos = ftell(addr->voutsfp); @@ -330,7 +330,7 @@ uint32_t iguana_ramchain_addunspent20(struct iguana_info *coin,struct iguana_pee printf("error writing vout scriptlen.%d errno.%d or scriptpos.%lld != %u\n",scriptlen,errno,(long long)scriptpos,u->scriptpos); else addr->dirty[0]++; #ifdef __PNACL__ - portable_mutex_unlock(&mutex); + //portable_mutex_unlock(&mutex); #endif } else printf("addr.%p unspent error fp.%p\n",addr,addr!=0?addr->voutsfp:0); } @@ -586,8 +586,8 @@ uint32_t iguana_ramchain_addspend256(struct iguana_info *coin,struct iguana_peer if ( (s->vinscriptlen= vinscriptlen) > 0 && vinscript != 0 && addr != 0 && addr->vinsfp != 0 && vinscriptlen < IGUANA_MAXSCRIPTSIZE) { #ifdef __PNACL__ - static portable_mutex_t mutex; - portable_mutex_lock(&mutex); + //static portable_mutex_t mutex; + //portable_mutex_lock(&mutex); #endif s->fileid = (uint32_t)addr->addrind; if ( (s->scriptpos= ftell(addr->vinsfp)) == 0 ) @@ -596,7 +596,7 @@ uint32_t iguana_ramchain_addspend256(struct iguana_info *coin,struct iguana_peer printf("error.%d writing vinscriptlen.%d errno.%d addrind.%d\n",err,vinscriptlen,errno,addr->addrind); else addr->dirty[1]++; #ifdef __PNACL__ - portable_mutex_unlock(&mutex); + //portable_mutex_unlock(&mutex); #endif } else s->scriptpos = 0; //else printf("spend256 scriptfpos.%d\n",s->scriptfpos); @@ -686,13 +686,13 @@ void *iguana_ramchain_offset(char *fname,void *dest,uint8_t *lhash,FILE *fp,uint else if ( fp != 0 && len > 0 ) { #ifdef __PNACL__ - static portable_mutex_t mutex; - portable_mutex_lock(&mutex); + //static portable_mutex_t mutex; + //portable_mutex_lock(&mutex); #endif startfpos = ftell(fp); err = fwrite(srcptr,1,len,fp); #ifdef __PNACL__ - portable_mutex_unlock(&mutex); + //portable_mutex_unlock(&mutex); #endif if ( err != len ) { @@ -702,19 +702,6 @@ void *iguana_ramchain_offset(char *fname,void *dest,uint8_t *lhash,FILE *fp,uint fprintf(stderr,"probably out of disk space. please free up space\n"); fpos = len = 0; } -#ifdef __PNACL__ - if ( 0 && len > 0 ) - { - int32_t i,c; - fseek(fp,startfpos,SEEK_SET); - for (i=0; ipeers.numfiles++; - else - { - printf("iguana_ramchain_save: couldnt create.(%s)\n",fname); - return(-1); - } - } - else if ( ipbits != 0 ) - { - //fseek(fp,0,SEEK_END); - } - else - { - fclose(fp); - if ( (fp= fopen(fname,"wb")) == 0 ) - { - printf("iguana_ramchain_save b: couldnt create.(%s)\n",fname); - return(-1); - } - }*/ #ifdef __PNACL__ - static portable_mutex_t mutex; - portable_mutex_lock(&mutex); + //static portable_mutex_t mutex; + //portable_mutex_lock(&mutex); #endif if ( (fp= fopen(fname,"wb")) == 0 ) printf("iguana_ramchain_save: couldnt create.(%s) errno.%d\n",fname,errno); @@ -1114,7 +1078,7 @@ long iguana_ramchain_save(struct iguana_info *coin,RAMCHAIN_FUNC,uint32_t ipbits fclose(fp); } #ifdef __PNACL__ - portable_mutex_unlock(&mutex); + //portable_mutex_unlock(&mutex); #endif return(fpos); } @@ -1540,13 +1504,13 @@ struct iguana_ramchain *iguana_ramchain_map(struct iguana_info *coin,char *fname { struct iguana_ramchain *retptr; #ifdef __PNACL__ - static portable_mutex_t mutex; - portable_mutex_lock(&mutex); + //static portable_mutex_t mutex; + //portable_mutex_lock(&mutex); #endif ramchain->height = bp->bundleheight; retptr = _iguana_ramchain_map(coin,fname,bp,numblocks,ramchain,hashmem,ipbits,hash2,prevhash2,bundlei,fpos,allocextras,expanded); #ifdef __PNACL__ - portable_mutex_unlock(&mutex); + //portable_mutex_unlock(&mutex); #endif return(retptr); } diff --git a/iguana/iguana_tx.c b/iguana/iguana_tx.c index edd3408ca..0302ffda2 100755 --- a/iguana/iguana_tx.c +++ b/iguana/iguana_tx.c @@ -300,7 +300,7 @@ int32_t iguana_peerblockrequest(struct iguana_info *coin,uint8_t *blockspace,int printf("iguana_peerblockrequest: block.%p ht.%d mainchain.%d [%d:%d]\n",block,block->height,block->mainchain,bp->hdrsi,bundlei); else printf("iguana_peerblockrequest: block.%p [%d:%d]\n",block,bp->hdrsi,bundlei); } - } else printf("iguana_peerblockrequest: cant find %s\n",bits256_str(str,hash2)); + } //else printf("iguana_peerblockrequest: cant find %s\n",bits256_str(str,hash2)); return(-1); } diff --git a/iguana/main.c b/iguana/main.c index 4c291744c..854a474b1 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -71,7 +71,7 @@ int32_t HDRnet,netBLOCKS; cJSON *API_json; #ifdef __PNACL__ -char GLOBAL_TMPDIR[512] = "/tmp"; +char GLOBAL_TMPDIR[512] = "/DB/tmp"; char GLOBAL_DBDIR[512] = "/DB"; char GLOBAL_HELPDIR[512] = "/DB/help"; char GLOBAL_VALIDATEDIR[512] = "/DB/purgeable"; diff --git a/pnacl_main.h b/pnacl_main.h index b46d0fff1..97bd076db 100755 --- a/pnacl_main.h +++ b/pnacl_main.h @@ -360,9 +360,9 @@ static PP_Bool Instance_DidCreate(PP_Instance instance,uint32_t argc,const char* nacl_io_init_ppapi(instance,g_get_browser_interface); umount("/"); mount("", "/", "memfs", 0, ""); - mkdir("/tmp",0755); + //mkdir("/tmp",0755); mkdir("/DB",0755); - mount("","/tmp","html5fs",0,"type=TEMPORARY,expected_size=2000000000"); + //mount("","/tmp","html5fs",0,"type=TEMPORARY,expected_size=2000000000"); mount("","/DB","html5fs",0,"type=PERSISTENT,expected_size=10000000000"); /*mount("", // source. Use relative URL "/http", // target