Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
992b75e319
  1. 43
      basilisk/basilisk.c
  2. 35
      basilisk/basilisk_CMD.c
  3. 8
      basilisk/basilisk_bitcoin.c
  4. 3
      gecko/gecko_blocks.c
  5. 2
      iguana/tests/rawtxB

43
basilisk/basilisk.c

@ -385,19 +385,58 @@ char *basilisk_standardservice(char *CMD,struct supernet_info *myinfo,void *_add
#include "basilisk_lisk.c"
#include "basilisk_CMD.c"
#include "../includes/iguana_apidefs.h"
#include "../includes/iguana_apideclares.h"
HASH_ARRAY_STRING(basilisk,balances,hash,vals,hexstr)
{
return(basilisk_standardservice("BAL",myinfo,0,hash,vals,hexstr,1));
//return(basilisk_standardcmd(myinfo,"BAL",activecoin,remoteaddr,basilisktag,vals,coin->basilisk_balances,coin->basilisk_balancesmetric));
}
HASH_ARRAY_STRING(basilisk,value,hash,vals,hexstr)
{
return(basilisk_standardservice("VAL",myinfo,0,hash,vals,hexstr,1));
//return(basilisk_standardcmd(myinfo,"VAL",activecoin,remoteaddr,basilisktag,vals,coin->basilisk_value,coin->basilisk_valuemetric));
}
HASH_ARRAY_STRING(basilisk,rawtx,hash,vals,hexstr)
{
char *retstr=0,*symbol; uint32_t basilisktag; struct basilisk_item *ptr,Lptr; int32_t timeoutmillis;
if ( (symbol= jstr(vals,"symbol")) != 0 || (symbol= jstr(vals,"coin")) != 0 )
{
if ( (coin= iguana_coinfind(symbol)) != 0 )
{
basilisktag = juint(vals,"basilisktag");
if ( juint(vals,"burn") == 0 )
jaddnum(vals,"burn",0.0001);
if ( (timeoutmillis= juint(vals,"timeout")) <= 0 )
timeoutmillis = BASILISK_TIMEOUT;
if ( (ptr= basilisk_bitcoinrawtx(&Lptr,myinfo,coin,remoteaddr,basilisktag,timeoutmillis,vals)) != 0 )
{
retstr = ptr->retstr;
}
if ( ptr != &Lptr )
free(ptr);
}
}
return(retstr);
}
#include "../includes/iguana_apiundefs.h"
void basilisk_functions(struct iguana_info *coin,int32_t protocol)
{
coin->protocol = protocol;
switch ( protocol )
{
case IGUANA_PROTOCOL_BITCOIN:
/*case IGUANA_PROTOCOL_BITCOIN:
coin->basilisk_balances = basilisk_bitcoinbalances;
coin->basilisk_rawtx = basilisk_bitcoinrawtx;
//coin->basilisk_rawtxmetric = basilisk_bitcoin_rawtxmetric;
coin->basilisk_value = basilisk_bitcoinvalue;
coin->basilisk_valuemetric = basilisk_bitcoin_valuemetric;
break;
/*case IGUANA_PROTOCOL_IOTA:
case IGUANA_PROTOCOL_IOTA:
coin->basilisk_balances = basilisk_iotabalances;
coin->basilisk_rawtx = basilisk_iotarawtx;
break;

35
basilisk/basilisk_CMD.c

@ -210,41 +210,6 @@ char *basilisk_respond_balances(struct supernet_info *myinfo,char *CMD,void *add
#include "../includes/iguana_apidefs.h"
#include "../includes/iguana_apideclares.h"
HASH_ARRAY_STRING(basilisk,balances,hash,vals,hexstr)
{
return(basilisk_standardservice("BAL",myinfo,0,hash,vals,hexstr,1));
//return(basilisk_standardcmd(myinfo,"BAL",activecoin,remoteaddr,basilisktag,vals,coin->basilisk_balances,coin->basilisk_balancesmetric));
}
HASH_ARRAY_STRING(basilisk,value,hash,vals,hexstr)
{
return(basilisk_standardservice("VAL",myinfo,0,hash,vals,hexstr,1));
//return(basilisk_standardcmd(myinfo,"VAL",activecoin,remoteaddr,basilisktag,vals,coin->basilisk_value,coin->basilisk_valuemetric));
}
HASH_ARRAY_STRING(basilisk,rawtx,hash,vals,hexstr)
{
char *retstr=0,*symbol; uint32_t basilisktag; struct basilisk_item *ptr,Lptr; int32_t timeoutmillis;
if ( (symbol= jstr(vals,"symbol")) != 0 || (symbol= jstr(vals,"coin")) != 0 )
{
if ( (coin= iguana_coinfind(symbol)) != 0 )
{
basilisktag = juint(vals,"basilisktag");
if ( juint(vals,"burn") == 0 )
jaddnum(vals,"burn",0.0001);
if ( (timeoutmillis= juint(vals,"timeout")) <= 0 )
timeoutmillis = BASILISK_TIMEOUT;
if ( (ptr= basilisk_bitcoinrawtx(&Lptr,myinfo,coin,remoteaddr,basilisktag,timeoutmillis,vals)) != 0 )
{
retstr = ptr->retstr;
}
if ( ptr != &Lptr )
free(ptr);
}
}
return(retstr);
}
HASH_ARRAY_STRING(basilisk,addrelay,hash,vals,hexstr)
{
return(basilisk_standardservice("ADD",myinfo,0,hash,vals,hexstr,1));

8
basilisk/basilisk_bitcoin.c

@ -576,15 +576,17 @@ void *basilisk_bitcoinrawtx(struct basilisk_item *Lptr,struct supernet_info *myi
uint8_t buf[IGUANA_MAXSCRIPTSIZE]; int32_t oplen,offset,numsent,minconf,spendlen; cJSON *vins,*addresses,*txobj = 0; uint32_t locktime; char *opreturn,*spendscriptstr,*changeaddr,*rawtx = 0; int64_t amount,txfee,burnamount;
vins = 0;
changeaddr = jstr(valsobj,"changeaddr");
spendscriptstr = jstr(valsobj,"spendscript");
amount = j64bits(valsobj,"satoshis");
if ( (amount= j64bits(valsobj,"satoshis")) == 0 )
amount = jdouble(valsobj,"value") * SATOSHIDEN;
if ( (txfee= j64bits(valsobj,"txfee")) == 0 )
txfee = coin->chain->txfee;
if ( txfee == 0 )
txfee = 10000;
spendscriptstr = jstr(valsobj,"spendscript");
minconf = juint(valsobj,"minconf");
locktime = juint(valsobj,"locktime");
addresses = jobj(valsobj,"addresses");
if ( (addresses= jobj(valsobj,"addresses")) == 0 )
addresses = iguana_getaddressesbyaccount(myinfo,coin,"*");
if ( changeaddr == 0 || changeaddr[0] == 0 || spendscriptstr == 0 || spendscriptstr[0] == 0 || amount == 0 || addresses == 0 )
{
printf("vals.(%s)\n",jprint(valsobj,0));

3
gecko/gecko_blocks.c

@ -265,7 +265,8 @@ char *gecko_blockarrived(struct supernet_info *myinfo,struct iguana_info *virt,c
prev->mainchain = 1;
if ( prev->height != (adjacent + 1 - j) )
prev->height = (adjacent + 1 - j);
gecko_bundleset(virt,prev);
gecko_ensurebundle(virt,prev,prev->height,0);
//gecko_bundleset(virt,prev);
if ( prev->height == 0 )
break;
}

2
iguana/tests/rawtxB

@ -1 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"timeout\":25000,\"agent\":\"basilisk\",\"method\":\"rawtx\",\"changeaddr\":\"RRyBxbrAPRUBCUpiJgJZYrkxqrh8x5ta9Z\",\"addresses\":[\"RRyBxbrAPRUBCUpiJgJZYrkxqrh8x5ta9Z\"],\"vals\":{\"coin\":\"BTCD\",\"amount\":\"20000\"},\"spendscriptstr\":\"76a914b7128d2ee837cf03e30a2c0e3e0181f7b9669bb688ac\"}"
curl --url "http://127.0.0.1:7778" --data "{\"timeout\":25000,\"agent\":\"basilisk\",\"method\":\"rawtx\",\"vals\":{\"changeaddr\":\"RRyBxbrAPRUBCUpiJgJZYrkxqrh8x5ta9Z\",\"coin\":\"BTCD\",\"satoshis\":\"20000\",\"spendscript\":\"76a914b7128d2ee837cf03e30a2c0e3e0181f7b9669bb688ac\"}}"

Loading…
Cancel
Save