Browse Source

Test

etomic
jl777 8 years ago
parent
commit
f7d545e3b5
  1. 3
      iguana/SuperNET_keys.c
  2. 3
      iguana/iguana_wallet.c
  3. 5
      iguana/main.c

3
iguana/SuperNET_keys.c

@ -364,6 +364,7 @@ void SuperNET_parsemyinfo(struct supernet_info *myinfo,cJSON *msgjson)
SuperNET_setkeys(myinfo,myinfo->persistent_priv.bytes,sizeof(myinfo->persistent_priv),0);
}
int32_t Encryptwallet;
char *SuperNET_keysinit(struct supernet_info *myinfo,char *argjsonstr)
{
long allocsize; cJSON *msgjson,*json=0; uint32_t r; bits256 wallethash,wallet2priv; int32_t len,c;
@ -376,7 +377,7 @@ char *SuperNET_keysinit(struct supernet_info *myinfo,char *argjsonstr)
SuperNET_parsemyinfo(myinfo,msgjson);
free_json(msgjson);
}
else
else if ( Encryptwallet != 0 )
{
if ( bits256_nonz(myinfo->persistent_priv) == 0 )
{

3
iguana/iguana_wallet.c

@ -15,6 +15,7 @@
#include "iguana777.h"
#include "exchanges/bitcoin.h"
extern int32_t EncryptWallet;
void scrubfree(char *sensitivestr)
{
@ -1392,6 +1393,7 @@ THREE_STRINGS(bitcoinrpc,encryptwallet,passphrase,password,permanentfile)
strcpy(myinfo->password,password);
if ( permanentfile != 0 )
strcpy(myinfo->permanentfile,permanentfile);
EncryptWallet = 1;
retstr = SuperNET_login(IGUANA_CALLARGS,myinfo->handle,myinfo->secret,myinfo->permanentfile,myinfo->password);
//myinfo->expiration = (uint32_t)time(NULL) + 3600*24;
struct iguana_waddress waddr; struct iguana_waccount *wacct;
@ -1434,6 +1436,7 @@ THREE_STRINGS(bitcoinrpc,encryptwallet,passphrase,password,permanentfile)
//iguana_walletinitcheck(myinfo,coin);
myinfo->dirty = (uint32_t)time(NULL);
myinfo->expiration = 0;
EncryptWallet = 0;
return(retstr);
}

5
iguana/main.c

@ -1535,6 +1535,7 @@ struct supernet_info *SuperNET_accountfind(cJSON *json)
FOUR_STRINGS(SuperNET,login,handle,password,permanentfile,passphrase)
{
extern int32_t EncryptWallet;
char *str,*decryptstr = 0; cJSON *argjson,*item,*walletitem;
if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}"));
@ -1585,7 +1586,7 @@ FOUR_STRINGS(SuperNET,login,handle,password,permanentfile,passphrase)
free(myinfo->decryptstr);
myinfo->decryptstr = 0;
}
if ( passphrase != 0 && passphrase[0] != 0 )
if ( passphrase != 0 && passphrase[0] != 0 && EncryptWallet != 0 )
{
SuperNET_setkeys(myinfo,passphrase,(int32_t)strlen(passphrase),1);
if ( myinfo->decryptstr != 0 && (argjson= cJSON_Parse(myinfo->decryptstr)) != 0 )
@ -1613,7 +1614,7 @@ FOUR_STRINGS(SuperNET,login,handle,password,permanentfile,passphrase)
free(str);
myinfo->expiration = (uint32_t)(time(NULL) + 3600);
return(SuperNET_activehandle(IGUANA_CALLARGS));
} else return(clonestr("{\"error\":\"need passphrase\"}"));
} else return(clonestr("{\"error\":\"need passphrase or wallet doesnt exist\"}"));
return(SuperNET_activehandle(IGUANA_CALLARGS));
}

Loading…
Cancel
Save