Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
77e071ffd8
  1. 2
      .gitignore
  2. 2
      crypto777/iguana_utils.c
  3. 7
      iguana/SuperNET.c
  4. 2
      iguana/iguana_wallet.c
  5. BIN
      iguana/tests/.priv2wif.swp
  6. 1
      iguana/tests/checkwallet
  7. 2
      iguana/tests/priv2wif
  8. 1
      iguana/tests/repairwallet

2
.gitignore

@ -22,3 +22,5 @@ iguana/pnacl/Release/iguana_unstripped.bc---linked.pre_opt.pexe
*.stamp
*.d
iguana/tests/.priv2wif.swp

2
crypto777/iguana_utils.c

@ -294,7 +294,7 @@ int32_t is_hexstr(char *str,int32_t n)
for (i=0; str[i]!=0&&(i<n||n==0); i++)
if ( _unhex(str[i]) < 0 )
return(0);
return(1);
return(n);
}
int32_t unhex(char c)

7
iguana/SuperNET.c

@ -1268,15 +1268,16 @@ STRING_ARG(SuperNET,wif2priv,wif)
STRING_ARG(SuperNET,priv2wif,priv)
{
bits256 privkey; char wifstr[65]; cJSON *retjson = cJSON_CreateObject();
bits256 privkey; char wifstr[65]; uint8_t wiftype; cJSON *retjson = cJSON_CreateObject();
if ( strlen(priv) == sizeof(bits256)*2 && is_hexstr(priv,(int32_t)sizeof(bits256)*2) == sizeof(bits256)*2 )
{
wiftype = coin != 0 ? coin->chain->wiftype : 0x80;
decode_hex(privkey.bytes,sizeof(privkey),priv);
if ( bitcoin_priv2wif(wifstr,privkey,coin->chain->wiftype) == sizeof(privkey) )
if ( bitcoin_priv2wif(wifstr,privkey,wiftype) == sizeof(privkey) )
{
jaddstr(retjson,"result","success");
jaddstr(retjson,"privkey",priv);
jaddnum(retjson,"type",coin->chain->wiftype);
jaddnum(retjson,"type",wiftype);
jaddstr(retjson,"wif",wifstr);
} else jaddstr(retjson,"error","couldnt convert privkey");
} else jaddstr(retjson,"error","non 32 byte hex privkey");

2
iguana/iguana_wallet.c

@ -33,7 +33,7 @@ struct iguana_waddress *iguana_waddressfind(struct supernet_info *myinfo,struct
{
struct iguana_waddress *waddr; int32_t len = (int32_t)strlen(coinaddr)+1;
HASH_FIND(hh,wacct->waddr,coinaddr,len,waddr);
if ( strcmp(coin->symbol,waddr->symbol) != 0 )
if ( waddr != 0 && coin != 0 && strcmp(coin->symbol,waddr->symbol) != 0 )
return(0);
//printf("%s (%s).%d in (%s)\n",waddr==0?"couldnt find":"found",coinaddr,len,wacct->account);
return(waddr);

BIN
iguana/tests/.priv2wif.swp

Binary file not shown.

1
iguana/tests/checkwallet

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"checkwallet\",\"params\":[]}"

2
iguana/tests/priv2wif

@ -1 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"iguana\",\"method\":\"priv2wif\",\"params\":[\"59c56c68e3e4910385523d67fe174509da7ddb6f7f35189e0d691d3b5e98ea0a\"]}"
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTC\",\"agent\":\"SuperNET\",\"method\":\"priv2wif\",\"priv\":\"59c56c68e3e4910385523d67fe174509da7ddb6f7f35189e0d691d3b5e98ea0a\"}"

1
iguana/tests/repairwallet

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"repairwallet\",\"params\":[]}"
Loading…
Cancel
Save