Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
88253ab3ca
  1. 9
      iguana/SuperNET.c
  2. 1
      iguana/exchanges/bitcoin.c
  3. 8
      iguana/iguana_instantdex.c

9
iguana/SuperNET.c

@ -1312,6 +1312,7 @@ ZERO_ARGS(SuperNET,activehandle)
retjson = SuperNET_rosettajson(myinfo->persistent_priv,0); retjson = SuperNET_rosettajson(myinfo->persistent_priv,0);
jaddstr(retjson,"result","success"); jaddstr(retjson,"result","success");
jaddstr(retjson,"handle",myinfo->handle); jaddstr(retjson,"handle",myinfo->handle);
jaddbits256(retjson,"persistent",myinfo->myaddr.persistent);
SuperNET_MYINFOadd(myinfo); SuperNET_MYINFOadd(myinfo);
return(jprint(retjson,1)); return(jprint(retjson,1));
} }
@ -1346,9 +1347,11 @@ struct supernet_info *SuperNET_accountfind(cJSON *json)
else if ( (passphrase= jstr(json,"result")) != 0 || (passphrase= jstr(json,"passphrase")) != 0 ) else if ( (passphrase= jstr(json,"result")) != 0 || (passphrase= jstr(json,"passphrase")) != 0 )
{ {
SuperNET_setkeys(&M,passphrase,(int32_t)strlen(passphrase),1); SuperNET_setkeys(&M,passphrase,(int32_t)strlen(passphrase),1);
myinfo = SuperNET_MYINFOfind(&num,M.myaddr.persistent); 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); {
return(myinfo); 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)); } else printf("no passphrase in (%s)\n",jprint(json,0));
free_json(json); free_json(json);
} else printf("cant parse.(%s)\n",decryptstr); } else printf("cant parse.(%s)\n",decryptstr);

1
iguana/exchanges/bitcoin.c

@ -1498,6 +1498,7 @@ uint64_t TRADE(int32_t dotrade,char **retstrp,struct exchange_info *exchange,cha
char *str,coinaddr[64]; uint64_t txid = 0; cJSON *tmp,*json=0; char *str,coinaddr[64]; uint64_t txid = 0; cJSON *tmp,*json=0;
struct supernet_info *myinfo; uint8_t pubkey[33]; struct iguana_info *other; int32_t hops = 3; struct supernet_info *myinfo; uint8_t pubkey[33]; struct iguana_info *other; int32_t hops = 3;
myinfo = SuperNET_accountfind(argjson); myinfo = SuperNET_accountfind(argjson);
printf("TRADE with myinfo.%p\n",myinfo);
if ( retstrp != 0 ) if ( retstrp != 0 )
*retstrp = 0; *retstrp = 0;
if ( strcmp(base,"BTC") == 0 || strcmp(base,"btc") == 0 ) if ( strcmp(base,"BTC") == 0 || strcmp(base,"btc") == 0 )

8
iguana/iguana_instantdex.c

@ -369,13 +369,7 @@ int32_t instantdex_acceptextract(struct instantdex_accept *ap,cJSON *argjson)
} else return(-1); } else return(-1);
//printf("price %f vol %f baserel.%d acceptdir.%d\n",price,volume,baserel,acceptdir); //printf("price %f vol %f baserel.%d acceptdir.%d\n",price,volume,baserel,acceptdir);
traderpub = jbits256(argjson,"traderpub"); traderpub = jbits256(argjson,"traderpub");
if ( (myinfo= SuperNET_MYINFOfind(&num,traderpub)) != 0 ) hash = instantdex_acceptset(ap,base,rel,INSTANTDEX_LOCKTIME*2,baserel,acceptdir,price,volume,traderpub.txid);
hash = instantdex_acceptset(ap,base,rel,INSTANTDEX_LOCKTIME*2,baserel,acceptdir,price,volume,myinfo->myaddr.nxt64bits);
else
{
char str[65]; printf("cant find account for (%s)\n",bits256_str(str,traderpub));
return(-1);
}
} }
else else
{ {

Loading…
Cancel
Save