diff --git a/iguana/SuperNET_keys.c b/iguana/SuperNET_keys.c index 3e7455b7e..37ee8b449 100755 --- a/iguana/SuperNET_keys.c +++ b/iguana/SuperNET_keys.c @@ -209,7 +209,7 @@ cJSON *SuperNET_decryptedjson(char *destfname,char *passphrase,int32_t passsize, SuperNET_linehash(fname2fa); // maps special chars wallet2priv = SuperNET_wallet2priv(fname2fa,wallethash); //char str[65],str2[65]; printf("(%s + %s) -> wallethash.%s 2.(%s)\n",passphrase,fname2fa,bits256_str(str,wallethash),bits256_str(str2,wallet2priv)); - } + } first = (bits256_nonz(wallethash) != 0 && bits256_cmp(wallethash,GENESIS_PRIVKEY) != 0); second = (bits256_nonz(wallet2priv) != 0 && bits256_cmp(wallet2priv,GENESIS_PRIVKEY) != 0); if ( first != 0 || second != 0 ) @@ -219,12 +219,12 @@ cJSON *SuperNET_decryptedjson(char *destfname,char *passphrase,int32_t passsize, wallet2shared = SuperNET_wallet2shared(wallethash,wallet2priv); wallet2pub = curve25519(wallet2shared,curve25519_basepoint9()); sprintf(destfname,"%s/%s",GLOBAL_CONFSDIR,bits256_str(str,wallet2pub)); - //printf("fname.(%s) wallet2pub.%s < [%s, %s]\n",destfname,bits256_str(str,wallet2pub),passphrase,fname2fa); + printf("fname.(%s) wallet2pub.%s < [%s, %s]\n",destfname,bits256_str(str,wallet2pub),passphrase,fname2fa); if ( (confstr= OS_filestr(&allocsize,destfname)) != 0 ) { if ( (filejson= cJSON_Parse(confstr)) != 0 ) { - //printf("confstr.(%s)\n",confstr); + printf("confstr.(%s)\n",confstr); if ( (deciphered= SuperNET_decipher(0,0,0,0,wallet2shared,curve25519(wallethash,curve25519_basepoint9()),jstr(filejson,"result"))) != 0 ) { if ( (json= cJSON_Parse(deciphered)) == 0 ) @@ -269,7 +269,7 @@ int32_t _SuperNET_encryptjson(struct supernet_info *myinfo,char *destfname,char wallet2shared = SuperNET_wallet2shared(wallethash,wallet2priv); wallet2pub = curve25519(wallet2shared,curve25519_basepoint9()); sprintf(destfname,"%s/%s",GLOBAL_CONFSDIR,bits256_str(str,wallet2pub)); - //printf("SAVE ARGJSON.(%s) [%s, %s] -> destfname.(%s)\n",jprint(argjson,0),passphrase,fname2fa,destfname); + printf("SAVE ARGJSON.(%s) [%s, %s] -> destfname.(%s)\n",jprint(argjson,0),passphrase,fname2fa,destfname); //printf("shared.%llx -> pub.%s\n",(long long)wallet2shared.txid,bits256_str(str,wallet2pub)); SuperNET_savejsonfile(myinfo,destfname,wallethash,wallet2pub,argjson); return(0); diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 2791f13ef..457b6a597 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -370,7 +370,7 @@ int32_t iguana_helperA(struct supernet_info *myinfo,struct iguana_info *coin,int printf("iguana_helperA unexpected null bp\n"); return(-1); } - printf("helperid.%d validate gen utxo.[%d] utxofinish.%u\n",helperid,bp->hdrsi,bp->utxofinish); + //printf("helperid.%d validate gen utxo.[%d] utxofinish.%u\n",helperid,bp->hdrsi,bp->utxofinish); if ( strcmp("BTC",coin->symbol) == 0 || iguana_bundlevalidate(coin,bp,0) == bp->n ) // { retval = 0; @@ -514,7 +514,7 @@ int32_t iguana_utxogen(struct supernet_info *myinfo,struct iguana_info *coin,int { printf("validate.[%d] error. refresh page or restart iguana and it should regenerate\n",bp->hdrsi); exit(-1); - } else printf("%s helperid.%d validated.[%d]\n",coin->symbol,helperid,hdrsi); + } // else printf("%s helperid.%d validated.[%d]\n",coin->symbol,helperid,hdrsi); } } while ( iguana_validated(coin) < max || iguana_utxofinished(coin) < max || iguana_balancefinished(coin) < max ) diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index d6b1d9840..f16b337f8 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -816,7 +816,11 @@ int32_t iguana_bundleready(struct iguana_info *coin,struct iguana_bundle *bp,int if ( 0 && requiredflag != 0 ) printf("not ready altpath.(%d %d %d %d %d) [%d:%d]\n",block->txvalid == 0,block->fpipbits == 0 ,block->fpos < 0,(bp->bundleheight+i > 0 && bits256_nonz(block->RO.prev_block) == 0),iguana_blockvalidate(coin,&valid,block,1) < 0,bp->hdrsi,i); } - else printf("cant find (%s)\n",fname); + else + { + iguana_blockunmark(coin,block,bp,i,1); + printf("cant find (%s)\n",fname); + } } } else diff --git a/iguana/iguana_realtime.c b/iguana/iguana_realtime.c index f582700f9..41ccbeda9 100755 --- a/iguana/iguana_realtime.c +++ b/iguana/iguana_realtime.c @@ -156,6 +156,7 @@ void iguana_RTspendvectors(struct supernet_info *myinfo,struct iguana_info *coin int32_t iterate,lasti,num,hdrsi,orignumemit; struct iguana_ramchain R; struct iguana_ramchaindata RDATA; if ( bp->hdrsi <= 0 ) return; + printf("RTspendvectors [%d]\n",bp->hdrsi); bp->ramchain = coin->RTramchain; iguana_rdataset(&R,&RDATA,&coin->RTramchain); if ( (lasti= (coin->RTheight - ((coin->RTheight/bp->n)*bp->n))) >= bp->n-1 ) diff --git a/iguana/iguana_spendvectors.c b/iguana/iguana_spendvectors.c index 81d3f7881..901b6b44a 100755 --- a/iguana/iguana_spendvectors.c +++ b/iguana/iguana_spendvectors.c @@ -449,7 +449,7 @@ int32_t iguana_balancegen(struct iguana_info *coin,int32_t incremental,struct ig struct iguana_spendvector *spend; struct iguana_unspent *spentU,*u; struct iguana_spendvector *Xspendinds; struct iguana_txid *T; struct iguana_blockRO *B; struct iguana_bundle *spentbp; int32_t spent_hdrsi,spendind,n,numXspends,errs=0,emit=0; struct iguana_spend *S,*s; - ramchain = &bp->ramchain; //(bp == coin->current) ? &coin->RTramchain : &bp->ramchain; + ramchain = (bp == coin->current) ? &coin->RTramchain : &bp->ramchain; if ( (rdata= ramchain->H.data) == 0 || (n= rdata->numspends) < 1 ) return(-1); S = (void *)(long)((long)rdata + rdata->Soffset); diff --git a/iguana/iguana_wallet.c b/iguana/iguana_wallet.c index 9738402d5..c94f4d514 100755 --- a/iguana/iguana_wallet.c +++ b/iguana/iguana_wallet.c @@ -772,6 +772,7 @@ void iguana_walletinitcheck(struct supernet_info *myinfo,struct iguana_info *coi cJSON *payload,*item,*array,*child; char *account,coinaddr[128],*privstr,wifstr[128]; int32_t i,p2shflag,n; struct iguana_waccount *wacct; struct iguana_waddress waddr; bits256 privkey; if ( myinfo->wallet == 0 && myinfo->decryptstr != 0 && (payload= cJSON_Parse(myinfo->decryptstr)) != 0 ) { + printf("WALLET.(%s)\n",myinfo->decryptstr); if ( (array= jobj(payload,"wallet")) != 0 ) { n = cJSON_GetArraySize(array); diff --git a/iguana/main.c b/iguana/main.c index 9a8650d28..edf2cb28a 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -473,20 +473,20 @@ void mainloop(struct supernet_info *myinfo) } } -void iguana_accounts() +void iguana_accounts(char *keytype) { long filesize; cJSON *json,*array,*item,*posting,*auths,*json2; int32_t i,n,m; char *str,*str2,*postingkey,*name,*key,fname[128],cmd[512]; FILE *postingkeys; if ( (str= OS_filestr(&filesize,"accounts.txt")) != 0 ) { if ( (json= cJSON_Parse(str)) != 0 ) { - if ( (array= jarray(&n,json,"result")) != 0 && (postingkeys= fopen("postingkeys.c","wb")) != 0 ) + if ( (array= jarray(&n,json,"result")) != 0 && (postingkeys= fopen("keys.c","wb")) != 0 ) { - fprintf(postingkeys,"char *postingkeys[][2] = {\n"); + fprintf(postingkeys,"char *%skeys[][2] = {\n",keytype); for (i=0; idecryptstr != 0 ) + { + free(myinfo->decryptstr); + myinfo->decryptstr = 0; + } if ( passphrase != 0 && passphrase[0] != 0 ) { SuperNET_setkeys(myinfo,passphrase,(int32_t)strlen(passphrase),1); @@ -1500,7 +1505,7 @@ FOUR_STRINGS(SuperNET,login,handle,password,permanentfile,passphrase) myinfo->expiration = (uint32_t)(time(NULL) + 3600); return(SuperNET_activehandle(IGUANA_CALLARGS)); } else return(clonestr("{\"error\":\"need passphrase\"}")); - printf("logged into (%s) %s %s\n",myinfo->myaddr.NXTADDR,myinfo->myaddr.BTC,myinfo->myaddr.BTCD); + printf("(%s) logged into (%s) %s %s\n",password,myinfo->myaddr.NXTADDR,myinfo->myaddr.BTC,myinfo->myaddr.BTCD); return(SuperNET_activehandle(IGUANA_CALLARGS)); } diff --git a/iguana/tests/igget b/iguana/tests/igget new file mode 100755 index 000000000..f92792b80 --- /dev/null +++ b/iguana/tests/igget @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getaccount\",\"params\":[\"RMd1Ek7bG7UknByTjfdDvJSXNUTahQKKWG\"]}" diff --git a/iguana/tests/igphrase b/iguana/tests/igphrase new file mode 100755 index 000000000..6f008031f --- /dev/null +++ b/iguana/tests/igphrase @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"method\":\"walletpassphrase\",\"params\":[\"igtest\", 66600]}" diff --git a/iguana/tests/igset b/iguana/tests/igset new file mode 100755 index 000000000..529097447 --- /dev/null +++ b/iguana/tests/igset @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"method\":\"setaccount\",\"params\":[\"RMd1Ek7bG7UknByTjfdDvJSXNUTahQKKWG\", \"igacct\"]}" diff --git a/includes/iguana_apideclares.h b/includes/iguana_apideclares.h index 9d6996707..eca0fcfcf 100755 --- a/includes/iguana_apideclares.h +++ b/includes/iguana_apideclares.h @@ -13,6 +13,8 @@ * * ******************************************************************************/ +//INT_AND_ARRAY(iguana,rates,unused,quotes); + ZERO_ARGS(InstantDEX,allcoins); STRING_ARG(InstantDEX,available,source); HASH_ARRAY_STRING(InstantDEX,request,hash,vals,hexstr);