Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
82426466ef
  1. 6
      iguana/SuperNET_keys.c
  2. 4
      iguana/iguana777.c
  3. 6
      iguana/iguana_bundles.c
  4. 1
      iguana/iguana_realtime.c
  5. 2
      iguana/iguana_spendvectors.c
  6. 1
      iguana/iguana_wallet.c
  7. 15
      iguana/main.c
  8. 1
      iguana/tests/igget
  9. 1
      iguana/tests/igphrase
  10. 1
      iguana/tests/igset
  11. 2
      includes/iguana_apideclares.h

6
iguana/SuperNET_keys.c

@ -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);

4
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 )

6
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

1
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 )

2
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);

1
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);

15
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; i<n; i++)
{
item = jitem(array,i);
if ( (name= jstr(item,"name")) != 0 && (posting= jobj(item,"posting")) != 0 )
if ( (name= jstr(item,"name")) != 0 && (posting= jobj(item,keytype)) != 0 )
{
if ( (auths= jarray(&m,posting,"key_auths")) != 0 )
{
@ -1471,6 +1471,11 @@ FOUR_STRINGS(SuperNET,login,handle,password,permanentfile,passphrase)
return(clonestr("{\"error\":\"cant parse decrypted json\"}"));
}
}
else if ( myinfo->decryptstr != 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));
}

1
iguana/tests/igget

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

1
iguana/tests/igphrase

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

1
iguana/tests/igset

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

2
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);

Loading…
Cancel
Save