|
|
@ -285,21 +285,56 @@ int32_t basilisk_verify_alicepaid(struct supernet_info *myinfo,struct basilisk_s |
|
|
|
|
|
|
|
int32_t basilisk_numconfirms(struct supernet_info *myinfo,struct basilisk_rawtx *rawtx) |
|
|
|
{ |
|
|
|
//return(iguana_numconfirms(rawtx->coin,rawtx->actualtxid));
|
|
|
|
return(10); |
|
|
|
cJSON *argjson,*valuearray=0,*item; char *valstr; int32_t numconfirms,height,i,n; |
|
|
|
/*int32_t height; struct iguana_txid T;
|
|
|
|
if ( iguana_txidfind(rawtx->coin,&height,&T,rawtx->actualtxid,rawtx->coin->bundlescount-1) != 0 )*/ |
|
|
|
argjson = cJSON_CreateObject(); |
|
|
|
jaddbits256(argjson,"txid",rawtx->actualtxid); |
|
|
|
jaddnum(argjson,"vout",0); |
|
|
|
jaddstr(argjson,"coin",rawtx->coin->symbol); |
|
|
|
if ( (valstr= basilisk_value(myinfo,rawtx->coin,0,0,myinfo->myaddr.persistent,argjson,0)) != 0 ) |
|
|
|
{ |
|
|
|
printf("valstr.(%s)\n",valstr); |
|
|
|
if ( (valuearray= cJSON_Parse(valstr)) != 0 ) |
|
|
|
{ |
|
|
|
if ( is_cJSON_Array(valuearray) != 0 ) |
|
|
|
{ |
|
|
|
n = cJSON_GetArraySize(valuearray); |
|
|
|
for (i=0; i<n; i++) |
|
|
|
{ |
|
|
|
item = jitem(valuearray,i); |
|
|
|
height = jint(valuearray,"height"); |
|
|
|
numconfirms = jint(valuearray,"numconfirms"); |
|
|
|
if ( height > 0 && numconfirms >= 0 ) |
|
|
|
{ |
|
|
|
free_json(argjson); |
|
|
|
free_json(valuearray); |
|
|
|
free(valstr); |
|
|
|
char str[65]; printf("%s height.%d -> numconfirms.%d\n",bits256_str(str,rawtx->actualtxid),height,numconfirms); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
free_json(argjson); |
|
|
|
if ( valuearray != 0 ) |
|
|
|
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 txid; |
|
|
|
bits256 txid; char *signedtx; |
|
|
|
memset(txid.bytes,0,sizeof(txid)); |
|
|
|
if ( data != 0 && datalen != 0 ) |
|
|
|
{ |
|
|
|
txid = bits256_doublesha256(0,data,datalen); |
|
|
|
int32_t i; for (i=0; i<datalen; i++) |
|
|
|
printf("%02x",data[i]); |
|
|
|
char str[65]; printf(" <- sendrawtransaction %s.(%s)\n",name,bits256_str(str,txid)); |
|
|
|
//txid = iguana_sendrawtransaction(coin,data,datalen);
|
|
|
|
//txid = bits256_doublesha256(0,data,datalen);
|
|
|
|
signedtx = malloc(datalen*2 + 1); |
|
|
|
init_hexbytes_noT(signedtx,data,datalen); |
|
|
|
txid = iguana_sendrawtransaction(myinfo,coin,signedtx); |
|
|
|
char str[65]; printf("%s <- sendrawtransaction %s.(%s)\n",name,signedtx,bits256_str(str,txid)); |
|
|
|
free(signedtx); |
|
|
|
} |
|
|
|
return(txid); |
|
|
|
} |
|
|
|