diff --git a/iguana/SuperNET.c b/iguana/SuperNET.c index 0cc2ef705..9d69f7880 100755 --- a/iguana/SuperNET.c +++ b/iguana/SuperNET.c @@ -1410,27 +1410,21 @@ struct supernet_info *SuperNET_accountfind(cJSON *json) FOUR_STRINGS(SuperNET,login,handle,password,permanentfile,passphrase) { - char *argstr,*str,*decryptstr = 0; cJSON *argjson; //uint32_t expire = myinfo->expiration; //savehandle[1024],savepassword[1024],savepermanentfile[1024] + char *argstr,*str,*decryptstr = 0; cJSON *argjson; if ( remoteaddr != 0 ) return(clonestr("{\"error\":\"no remote\"}")); - //safecopy(savehandle,myinfo->handle,sizeof(myinfo->handle)); - //safecopy(savepassword,myinfo->secret,sizeof(myinfo->secret)); - //safecopy(savepermanentfile,myinfo->permanentfile,sizeof(myinfo->permanentfile)); - //if ( bits256_nonz(myinfo->persistent_priv) != 0 && (str= SuperNET_logout(IGUANA_CALLARGS)) != 0 ) - // free(str); - //myinfo->expiration = expire; if ( handle != 0 && handle[0] != 0 ) safecopy(myinfo->handle,handle,sizeof(myinfo->handle)); else memset(myinfo->handle,0,sizeof(myinfo->handle)); - if ( password != 0 && password[0] != 0 ) + if ( password == 0 || password[0] == 0 ) + password = passphrase; + /*if ( password != 0 && password[0] != 0 ) safecopy(myinfo->secret,password,sizeof(myinfo->secret)); else if ( passphrase != 0 && passphrase[0] != 0 ) - safecopy(myinfo->secret,passphrase,sizeof(myinfo->secret)); - //else memset(myinfo->secret,0,sizeof(myinfo->secret)); + safecopy(myinfo->secret,passphrase,sizeof(myinfo->secret));*/ if ( permanentfile != 0 ) safecopy(myinfo->permanentfile,permanentfile,sizeof(myinfo->permanentfile)); - //else memset(myinfo->permanentfile,0,sizeof(myinfo->permanentfile)); - if ( (decryptstr= SuperNET_decryptjson(IGUANA_CALLARGS,myinfo->secret,myinfo->permanentfile)) != 0 ) + if ( (decryptstr= SuperNET_decryptjson(IGUANA_CALLARGS,password,myinfo->permanentfile)) != 0 ) { if ( (argjson= cJSON_Parse(decryptstr)) != 0 ) { @@ -1472,12 +1466,11 @@ FOUR_STRINGS(SuperNET,login,handle,password,permanentfile,passphrase) } else argjson = cJSON_CreateObject(); jaddstr(argjson,"passphrase",passphrase); argstr = jprint(argjson,1); - if ( (str= SuperNET_encryptjson(IGUANA_CALLARGS,myinfo->secret,myinfo->permanentfile,argstr)) != 0 ) + if ( (str= SuperNET_encryptjson(IGUANA_CALLARGS,password,myinfo->permanentfile,argstr)) != 0 ) free(str); free(argstr); return(SuperNET_activehandle(IGUANA_CALLARGS)); - } - else return(clonestr("{\"error\":\"need passphrase\"}")); + } else return(clonestr("{\"error\":\"need passphrase\"}")); printf("logged into (%s) %s %s\n",myinfo->myaddr.NXTADDR,myinfo->myaddr.BTC,myinfo->myaddr.BTCD); return(SuperNET_activehandle(IGUANA_CALLARGS)); } diff --git a/iguana/SuperNET_keys.c b/iguana/SuperNET_keys.c index 999ed6c0e..0864afa9f 100755 --- a/iguana/SuperNET_keys.c +++ b/iguana/SuperNET_keys.c @@ -202,7 +202,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); @@ -213,7 +213,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/chart.html b/iguana/chart.html new file mode 100755 index 000000000..510a34544 --- /dev/null +++ b/iguana/chart.html @@ -0,0 +1,168 @@ + + + + + amStock Example + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/iguana/iguana_instantdex.c b/iguana/iguana_instantdex.c index 43e1efd14..ae3b19d5f 100755 --- a/iguana/iguana_instantdex.c +++ b/iguana/iguana_instantdex.c @@ -885,7 +885,8 @@ int32_t instantdex_quoterequest(struct supernet_info *myinfo,struct iguana_info int32_t instantdex_quotep2p(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,uint8_t *serialized,int32_t recvlen) { - bits256 orderhash,encodedhash; int32_t checklen; struct instantdex_accept A,*ap; struct exchange_info *exchange = exchanges777_find("bitcoin"); //char hexstr[8192]; + bits256 orderhash,encodedhash; int32_t checklen; struct instantdex_accept A,*ap; struct exchange_info *exchange; char *retstr; cJSON *argjson; uint64_t txid; + exchange = exchanges777_find("bitcoin"); memset(&A,0,sizeof(A)); orderhash = instantdex_rwoffer(0,&checklen,serialized,&A.offer), A.orderid = orderhash.txid; if ( checklen == recvlen ) @@ -899,7 +900,10 @@ int32_t instantdex_quotep2p(struct supernet_info *myinfo,struct iguana_info *coi ap = calloc(1,sizeof(*ap)); *ap = A; SETBIT(ap->peerhas,addr->addrind); - queue_enqueue("acceptableQ",&exchange->acceptableQ,&ap->DL,0); + argjson = cJSON_Parse("{}"); + if ( (retstr= instantdex_checkoffer(myinfo,&txid,exchange,ap,argjson)) != 0 ) + free(retstr); + free_json(argjson); } } else diff --git a/iguana/iguana_rpc.c b/iguana/iguana_rpc.c index 4f611ba80..f398cdc79 100755 --- a/iguana/iguana_rpc.c +++ b/iguana/iguana_rpc.c @@ -664,7 +664,7 @@ char *iguana_bitcoinRPC(struct supernet_info *myinfo,char *method,cJSON *json,ch { safecopy(symbol,jstr(json,"coin"),sizeof(symbol)); for (i=0; symbol[i]!=0; i++) - symbol[i] = toupper(symbol[i]); + symbol[i] = toupper((int32_t)symbol[i]); } if ( myinfo->rpcsymbol[0] == 0 ) strcpy(myinfo->rpcsymbol,symbol); diff --git a/iguana/iguana_wallet.c b/iguana/iguana_wallet.c index 210e85f0c..a58aa5405 100755 --- a/iguana/iguana_wallet.c +++ b/iguana/iguana_wallet.c @@ -1207,6 +1207,8 @@ STRING_ARG(bitcoinrpc,dumpwallet,filename) char *retstr,*walletstr; cJSON *retjson,*walletobj,*strobj; if ( remoteaddr != 0 ) return(clonestr("{\"error\":\"no remote\"}")); + if ( myinfo->expiration == 0 ) + return(clonestr("{\"error\":\"need to unlock wallet\"}")); if ( myinfo->expiration != 0 ) { myinfo->expiration++; @@ -1239,6 +1241,8 @@ STRING_ARG(bitcoinrpc,backupwallet,filename) char *loginstr,*retstr = 0; cJSON *retjson,*payload; if ( remoteaddr != 0 ) return(clonestr("{\"error\":\"no remote\"}")); + if ( myinfo->expiration == 0 ) + return(clonestr("{\"error\":\"need to unlock wallet\"}")); if ( myinfo->expiration != 0 ) { myinfo->expiration++; @@ -1265,6 +1269,8 @@ STRING_ARG(bitcoinrpc,importwallet,filename) cJSON *retjson = 0,*importjson,*loginjson = 0; long filesize; char *importstr,*loginstr; if ( remoteaddr != 0 ) return(clonestr("{\"error\":\"no remote\"}")); + if ( myinfo->expiration == 0 ) + return(clonestr("{\"error\":\"need to unlock wallet\"}")); if ( myinfo->expiration != 0 ) { myinfo->expiration++; diff --git a/iguana/index.html b/iguana/index.html index 50efa9c89..3f4af3aff 100755 --- a/iguana/index.html +++ b/iguana/index.html @@ -15,6 +15,130 @@ + + + + + + + + @@ -53,6 +177,8 @@ data-path="{tc}/{config}">