Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
17bbe3a168
  1. 2
      basilisk/basilisk.h
  2. 20
      basilisk/basilisk_swap.c

2
basilisk/basilisk.h

@ -30,7 +30,7 @@
#define BASILISK_HDROFFSET ((int32_t)(sizeof(bits256)+sizeof(struct iguana_msghdr)+sizeof(uint32_t))) #define BASILISK_HDROFFSET ((int32_t)(sizeof(bits256)+sizeof(struct iguana_msghdr)+sizeof(uint32_t)))
#define INSTANTDEX_DECKSIZE 1000 #define INSTANTDEX_DECKSIZE 1000
#define INSTANTDEX_LOCKTIME (1800 + 300*2) #define INSTANTDEX_LOCKTIME (3600*2 + 300*2)
#define INSTANTDEX_INSURANCEDIV 777 #define INSTANTDEX_INSURANCEDIV 777
#define INSTANTDEX_PUBKEY "03bc2c7ba671bae4a6fc835244c9762b41647b9827d4780a89a949b984a8ddcc06" #define INSTANTDEX_PUBKEY "03bc2c7ba671bae4a6fc835244c9762b41647b9827d4780a89a949b984a8ddcc06"
#define INSTANTDEX_RMD160 "ca1e04745e8ca0c60d8c5881531d51bec470743f" #define INSTANTDEX_RMD160 "ca1e04745e8ca0c60d8c5881531d51bec470743f"

20
basilisk/basilisk_swap.c

@ -118,7 +118,7 @@ int32_t basilisk_alicescript(uint8_t *script,int32_t n,char *msigaddr,uint8_t al
int32_t basilisk_numconfirms(struct supernet_info *myinfo,struct basilisk_rawtx *rawtx) int32_t basilisk_numconfirms(struct supernet_info *myinfo,struct basilisk_rawtx *rawtx)
{ {
cJSON *argjson,*valuearray=0,*item; char *valstr; int32_t numconfirms,height,i,n; cJSON *argjson,*valuearray=0,*item; char *valstr; int32_t numconfirms,height,i,n,retval = -1;
#ifdef BASILISK_DISABLETX #ifdef BASILISK_DISABLETX
return(10); return(10);
#endif #endif
@ -128,7 +128,7 @@ int32_t basilisk_numconfirms(struct supernet_info *myinfo,struct basilisk_rawtx
jaddstr(argjson,"coin",rawtx->coin->symbol); jaddstr(argjson,"coin",rawtx->coin->symbol);
if ( (valstr= basilisk_value(myinfo,rawtx->coin,0,0,myinfo->myaddr.persistent,argjson,0)) != 0 ) if ( (valstr= basilisk_value(myinfo,rawtx->coin,0,0,myinfo->myaddr.persistent,argjson,0)) != 0 )
{ {
char str[65]; printf("%s %s valstr.(%s)\n",rawtx->name,bits256_str(str,rawtx->actualtxid),valstr); //char str[65]; printf("%s %s valstr.(%s)\n",rawtx->name,bits256_str(str,rawtx->actualtxid),valstr);
if ( (valuearray= cJSON_Parse(valstr)) != 0 ) if ( (valuearray= cJSON_Parse(valstr)) != 0 )
{ {
if ( is_cJSON_Array(valuearray) != 0 ) if ( is_cJSON_Array(valuearray) != 0 )
@ -139,22 +139,20 @@ int32_t basilisk_numconfirms(struct supernet_info *myinfo,struct basilisk_rawtx
item = jitem(valuearray,i); item = jitem(valuearray,i);
height = jint(item,"height"); height = jint(item,"height");
numconfirms = jint(item,"numconfirms"); numconfirms = jint(item,"numconfirms");
printf("i.%d of %d: %s height.%d -> numconfirms.%d\n",i,n,bits256_str(str,rawtx->actualtxid),height,numconfirms); char str[65]; printf("i.%d of %d: %s height.%d -> numconfirms.%d\n",i,n,bits256_str(str,rawtx->actualtxid),height,numconfirms);
if ( height > 0 && numconfirms >= 0 ) if ( height > 0 && numconfirms >= 0 )
{ {
free_json(argjson); retval = numconfirms;
free_json(valuearray); break;
free(valstr);
} }
} }
} else printf("valstr not array\n"); } else printf("valstr not array\n");
free_json(valuearray);
} else printf("parse error\n"); } else printf("parse error\n");
free(valstr);
} }
free_json(argjson); free_json(argjson);
if ( valuearray != 0 ) return(retval);
free_json(valuearray);
free(valstr);
return(-1);
} }
bits256 basilisk_swap_broadcast(char *name,struct supernet_info *myinfo,struct basilisk_swap *swap,struct iguana_info *coin,uint8_t *data,int32_t datalen) bits256 basilisk_swap_broadcast(char *name,struct supernet_info *myinfo,struct basilisk_swap *swap,struct iguana_info *coin,uint8_t *data,int32_t datalen)

Loading…
Cancel
Save