Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
d5c3c3abd5
  1. 2
      basilisk/basilisk.c
  2. 4
      basilisk/basilisk_MSG.c
  3. 6
      basilisk/basilisk_bitcoin.c
  4. 8
      basilisk/basilisk_swap.c
  5. 2
      iguana/main.c
  6. 2
      iguana/tests/validateaddress

2
basilisk/basilisk.c

@ -914,7 +914,7 @@ void basilisks_loop(void *arg)
}
}
portable_mutex_unlock(&myinfo->messagemutex);
usleep(1000000);
usleep(100000);
}
}

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

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

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

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

2
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\"]}"

Loading…
Cancel
Save