From d5c3c3abd53bc5bd620a9e5b02b0cc318432bc52 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 3 Jul 2016 23:01:06 -0300 Subject: [PATCH] test --- basilisk/basilisk.c | 2 +- basilisk/basilisk_MSG.c | 4 ++-- basilisk/basilisk_bitcoin.c | 6 +++--- basilisk/basilisk_swap.c | 8 ++++---- iguana/main.c | 2 +- iguana/tests/validateaddress | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index 7ee0a668d..16feadb38 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -914,7 +914,7 @@ void basilisks_loop(void *arg) } } portable_mutex_unlock(&myinfo->messagemutex); - usleep(1000000); + usleep(100000); } } diff --git a/basilisk/basilisk_MSG.c b/basilisk/basilisk_MSG.c index 1cacc27fd..f19869f61 100755 --- a/basilisk/basilisk_MSG.c +++ b/basilisk/basilisk_MSG.c @@ -207,7 +207,7 @@ int32_t basilisk_message_returned(uint8_t *data,int32_t maxlen,cJSON *item) retval = datalen; } else printf("datalen.%d < maxlen.%d\n",datalen,maxlen); } else printf("no hexstr.%p or datalen.%d\n",hexstr,datalen); - } else printf("no msgobj\n"); + } //else printf("no msgobj\n"); return(retval); } @@ -220,7 +220,7 @@ int32_t basilisk_channelget(struct supernet_info *myinfo,bits256 hash,uint32_t c jaddnum(valsobj,"fanout",1); if ( (retstr= basilisk_getmessage(myinfo,0,0,0,hash,valsobj,0)) != 0 ) { - printf("gotmessage.(%s)\n",retstr); + //printf("gotmessage.(%s)\n",retstr); if ( (retarray= cJSON_Parse(retstr)) != 0 ) { if ( is_cJSON_Array(retarray) != 0 ) diff --git a/basilisk/basilisk_bitcoin.c b/basilisk/basilisk_bitcoin.c index c26ca5246..740b94ed1 100755 --- a/basilisk/basilisk_bitcoin.c +++ b/basilisk/basilisk_bitcoin.c @@ -655,8 +655,8 @@ void *basilisk_bitcoinrawtx(struct basilisk_item *Lptr,struct supernet_info *myi locktime = juint(valsobj,"locktime"); if ( (addresses= jobj(valsobj,"addresses")) == 0 ) addresses = iguana_getaddressesbyaccount(myinfo,coin,"*"); - //printf("vals.(%s)\n",jprint(valsobj,0)); - if ( changeaddr == 0 || changeaddr[0] == 0 || spendscriptstr == 0 || spendscriptstr[0] == 0 || amount == 0 || addresses == 0 ) + printf("vals.(%s) change.(%s) spend.%s\n",jprint(valsobj,0),changeaddr,spendscriptstr); + if ( changeaddr == 0 || changeaddr[0] == 0 || spendscriptstr == 0 || spendscriptstr[0] == 0 )//|| amount == 0 || addresses == 0 ) { Lptr->retstr = clonestr("{\"error\":\"invalid changeaddr or spendscript or addresses\"}"); return(Lptr); @@ -1008,7 +1008,7 @@ HASH_ARRAY_STRING(basilisk,value,hash,vals,hexstr) basilisktag = rand(); if ( (timeoutmillis= juint(vals,"timeout")) <= 0 ) timeoutmillis = BASILISK_TIMEOUT; - if ( coin->RELAYNODE != 0 && (ptr= basilisk_bitcoinrawtx(&Lptr,myinfo,coin,remoteaddr,basilisktag,timeoutmillis,vals)) != 0 ) + if ( coin->RELAYNODE != 0 && (ptr= basilisk_bitcoinvalue(&Lptr,myinfo,coin,remoteaddr,basilisktag,timeoutmillis,vals)) != 0 ) { retstr = ptr->retstr, ptr->retstr = 0; ptr->finished = (uint32_t)time(NULL); diff --git a/basilisk/basilisk_swap.c b/basilisk/basilisk_swap.c index 19b316719..95c4e9cb6 100755 --- a/basilisk/basilisk_swap.c +++ b/basilisk/basilisk_swap.c @@ -141,7 +141,7 @@ int32_t basilisk_rawtx_gen(char *str,struct supernet_info *myinfo,struct basilis basilisktag = (uint32_t)rand(); jaddistr(addresses,coinaddr); valsobj = cJSON_CreateObject(); - jadd(valsobj,"addresses",addresses); + //jadd(valsobj,"addresses",addresses); jaddstr(valsobj,"coin",rawtx->coin->symbol); jaddstr(valsobj,"spendscript",scriptstr); jaddstr(valsobj,"changeaddr",rawtx->coin->changeaddr); @@ -180,7 +180,7 @@ int32_t basilisk_rawtx_gen(char *str,struct supernet_info *myinfo,struct basilis free(retstr); } else printf("error creating %s feetx\n",swap->iambob != 0 ? "BOB" : "ALICE"); free_json(valsobj); - free_json(privkeyarray); + //free_json(privkeyarray); return(retval); } @@ -591,7 +591,7 @@ void basilisk_swaploop(void *_swap) } else if ( (swap->statebits & 0x40) == 0 ) // send fee { - if ( swap->myfee.txbytes != 0 || basilisk_rawtx_gen("setparms",myinfo,swap,1,&swap->myfee,0,swap->myfee.spendscript,swap->myfee.spendlen,swap->myfee.coin->chain->txfee,1) == 0 ) + if ( swap->myfee.txbytes != 0 || basilisk_rawtx_gen("myfee",myinfo,swap,1,&swap->myfee,0,swap->myfee.spendscript,swap->myfee.spendlen,swap->myfee.coin->chain->txfee,1) == 0 ) swap->statebits |= basilisk_swapdata_rawtxsend(myinfo,swap,0x80,data,maxlen,&swap->myfee,0x40); } else if ( (swap->statebits & 0x80) == 0 ) // wait for fee @@ -718,7 +718,7 @@ void basilisk_swaploop(void *_swap) } } } - sleep(3); + usleep(1000000); } printf("swap finished statebits %x\n",swap->statebits); basilisk_swap_purge(myinfo,swap); diff --git a/iguana/main.c b/iguana/main.c index 39f5cab29..203e410cc 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -1155,7 +1155,7 @@ void iguana_appletests(struct supernet_info *myinfo) bitcoin_sharedsecret(myinfo->ctx,hash2,pubkey,33); printf("secp256k1 elapsed %.3f for %d iterations\n",OS_milliseconds() - startmillis,i); getchar();**/ - if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"protover\":70002,\"RELAY\":0,\"VALIDATE\":0,\"portp2p\":14631,\"rpc\":14632,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":64,\"endpend\":64,\"services\":129,\"maxpeers\":8,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":1,\"poll\":1}"),0,myinfo->rpcport)) != 0 ) + if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"protover\":70002,\"RELAY\":1,\"VALIDATE\":0,\"portp2p\":14631,\"rpc\":14632,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":64,\"endpend\":64,\"services\":129,\"maxpeers\":8,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":1,\"poll\":1}"),0,myinfo->rpcport)) != 0 ) { free(str); if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"portp2p\":8333,\"RELAY\":0,\"VALIDATE\":0,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":8,\"newcoin\":\"BTC\",\"active\":0,\"numhelpers\":1,\"poll\":100}"),0,myinfo->rpcport)) != 0 ) diff --git a/iguana/tests/validateaddress b/iguana/tests/validateaddress index ef1426b77..1ea44c657 100755 --- a/iguana/tests/validateaddress +++ b/iguana/tests/validateaddress @@ -1 +1 @@ -curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTC\",\"method\":\"validateaddress\",\"params\":[\"1BnPHAZuPvYSgWkRfEu6wHDL8uGRzDcTjt\"]}" +curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"validateaddress\",\"params\":[\"RSyKVKNxrSDc1Vwvh4guYb9ZDEpvMFz2rm\"]}"