Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
93ffa2cac5
  1. 22
      iguana/SuperNET.c
  2. 2
      iguana/SuperNET_keys.c
  3. 9
      iguana/iguana_wallet.c

22
iguana/SuperNET.c

@ -1419,7 +1419,7 @@ struct supernet_info *SuperNET_accountfind(cJSON *json)
FOUR_STRINGS(SuperNET,login,handle,password,permanentfile,passphrase)
{
char *argstr,*str,*decryptstr = 0; cJSON *argjson;
char *str,*decryptstr = 0; cJSON *argjson,*item,*walletitem;
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
if ( handle != 0 && handle[0] != 0 )
@ -1472,12 +1472,24 @@ FOUR_STRINGS(SuperNET,login,handle,password,permanentfile,passphrase)
jdelete(argjson,"passphrase");
if ( jobj(argjson,"error") != 0 )
jdelete(argjson,"error");
} else argjson = cJSON_CreateObject();
}
else
{
char rmd160str[41],str[65]; uint8_t rmd160[20],pubkey33[33];
bitcoin_pubkey33(myinfo->ctx,pubkey33,myinfo->privkey);
calc_rmd160_sha256(rmd160,pubkey33,33);
init_hexbytes_noT(rmd160str,rmd160,20);
argjson = cJSON_CreateObject();
item = cJSON_CreateObject();
walletitem = cJSON_CreateObject();
jaddstr(item,rmd160str,bits256_str(str,myinfo->privkey));
jadd(walletitem,"default",item);
jadd(argjson,"wallet",walletitem);
myinfo->dirty = (uint32_t)time(NULL);
}
jaddstr(argjson,"passphrase",passphrase);
argstr = jprint(argjson,1);
if ( (str= SuperNET_encryptjson(IGUANA_CALLARGS,password,myinfo->permanentfile,argstr)) != 0 )
if ( (str= SuperNET_encryptjson(myinfo,coin,argjson,remoteaddr,password,myinfo->permanentfile,"")) != 0 )
free(str);
free(argstr);
myinfo->expiration = (uint32_t)(time(NULL) + 3600);
return(SuperNET_activehandle(IGUANA_CALLARGS));
} else return(clonestr("{\"error\":\"need passphrase\"}"));

2
iguana/SuperNET_keys.c

@ -357,7 +357,7 @@ char *SuperNET_keysinit(struct supernet_info *myinfo,char *argjsonstr)
jadd64bits(json,"rand",r);
//printf("call SuperNET_encryptjson\n");
_SuperNET_encryptjson(destfname,passphrase,sizeof(passphrase),fname2fa,sizeof(fname2fa),json);
//printf("save.(%s)\n",jprint(json,0));
printf("save.(%s)\n",jprint(json,0));
free_json(json);
}
if ( myinfo->ipaddr[0] == 0 )

9
iguana/iguana_wallet.c

@ -401,7 +401,7 @@ int32_t iguana_loginsave(struct supernet_info *myinfo,struct iguana_info *coin,c
if ( (passphrase= jstr(loginjson,"passphrase")) != 0 )
{
_SuperNET_encryptjson(destfname,passphrase,0,myinfo->permanentfile,0,loginjson);
//printf("loginsave.(%s) <= (%s)\n",destfname,newstr);
printf("loginsave.(%s) <= (%s)\n",destfname,newstr);
//iguana_walletlock(myinfo);
}
free_json(loginjson);
@ -788,12 +788,6 @@ void iguana_walletinitcheck(struct supernet_info *myinfo,struct iguana_info *coi
}
child = child->next;
}
if ( strcmp(account,"default") == 0 )
{
privkey = myinfo->privkey;
if ( iguana_waddresscalc(myinfo,coin->chain->pubtype,coin->chain->wiftype,&waddr,privkey) != 0 )
iguana_waddressadd(myinfo,coin,wacct,&waddr,0);
}
//printf("account.(%s)\n",account);
}
item = item->next;
@ -889,7 +883,6 @@ int64_t iguana_addressreceived(struct supernet_info *myinfo,struct iguana_info *
return(balance);
}
char *getnewaddress(struct supernet_info *myinfo,struct iguana_waddress **waddrp,struct iguana_info *coin,char *account,char *retstr)
{
struct iguana_waddress addr; cJSON *retjson;

Loading…
Cancel
Save