From f7d545e3b51baa067484e02a1834fc2d5a8e0820 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 10 Mar 2017 10:03:32 +0200 Subject: [PATCH] Test --- iguana/SuperNET_keys.c | 3 ++- iguana/iguana_wallet.c | 3 +++ iguana/main.c | 5 +++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/iguana/SuperNET_keys.c b/iguana/SuperNET_keys.c index b44fc1b18..6eb315550 100755 --- a/iguana/SuperNET_keys.c +++ b/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 ) { diff --git a/iguana/iguana_wallet.c b/iguana/iguana_wallet.c index 90303ae80..bdb940621 100755 --- a/iguana/iguana_wallet.c +++ b/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); } diff --git a/iguana/main.c b/iguana/main.c index ac883a401..f40b7076c 100755 --- a/iguana/main.c +++ b/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)); }