From 77e071ffd8bdb7a1bf6d0a28ecaac892e74ab005 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 3 May 2016 15:30:59 -0500 Subject: [PATCH] test --- .gitignore | 2 ++ crypto777/iguana_utils.c | 2 +- iguana/SuperNET.c | 7 ++++--- iguana/iguana_wallet.c | 2 +- iguana/tests/.priv2wif.swp | Bin 12288 -> 0 bytes iguana/tests/checkwallet | 1 + iguana/tests/priv2wif | 2 +- iguana/tests/repairwallet | 1 + 8 files changed, 11 insertions(+), 6 deletions(-) delete mode 100644 iguana/tests/.priv2wif.swp create mode 100755 iguana/tests/checkwallet create mode 100755 iguana/tests/repairwallet diff --git a/.gitignore b/.gitignore index 467a94514..5d85732b5 100755 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ iguana/pnacl/Release/iguana_unstripped.bc---linked.pre_opt.pexe *.stamp *.d + +iguana/tests/.priv2wif.swp diff --git a/crypto777/iguana_utils.c b/crypto777/iguana_utils.c index e7445064d..f4da6a4a7 100755 --- a/crypto777/iguana_utils.c +++ b/crypto777/iguana_utils.c @@ -294,7 +294,7 @@ int32_t is_hexstr(char *str,int32_t n) for (i=0; str[i]!=0&&(ichain->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"); diff --git a/iguana/iguana_wallet.c b/iguana/iguana_wallet.c index 5d0600ec9..2c16d9d63 100755 --- a/iguana/iguana_wallet.c +++ b/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); diff --git a/iguana/tests/.priv2wif.swp b/iguana/tests/.priv2wif.swp deleted file mode 100644 index d683008b0965b4f5e110fc391edca199f88a91bb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI&&rgFe6bJCmn0PW8{Rgm~Ox*a4l8J!-C@xRl*$(vjtTkNzj*jqii6K9LS{vk)}?Gr-E`HhQ5Ex| z9}LPmljYWjY{4D3deOSGl5_4Blck)?&0utETDMsg&%sNP|FsBe5P-lx1r7-de6O2) zPS2dvlkq>-!88a!00Izz00bZa0SG`~7X?hyBky+Odq11+Z5em*-LPi}KmY;|fB*y_ z009U<00Izz00hzp0YqiR5 zdg534MlNL4+We!SVUmSW7R8$BVd8r%4#R+{i09hp!_Z5VY{M diff --git a/iguana/tests/checkwallet b/iguana/tests/checkwallet new file mode 100755 index 000000000..7df59c569 --- /dev/null +++ b/iguana/tests/checkwallet @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"method\":\"checkwallet\",\"params\":[]}" diff --git a/iguana/tests/priv2wif b/iguana/tests/priv2wif index d3f94b404..99ce4f73a 100755 --- a/iguana/tests/priv2wif +++ b/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\"}" diff --git a/iguana/tests/repairwallet b/iguana/tests/repairwallet new file mode 100755 index 000000000..c5f412816 --- /dev/null +++ b/iguana/tests/repairwallet @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"method\":\"repairwallet\",\"params\":[]}"