diff --git a/basilisk/basilisk_MSG.c b/basilisk/basilisk_MSG.c index ec8ce2911..9a1e3bbd2 100755 --- a/basilisk/basilisk_MSG.c +++ b/basilisk/basilisk_MSG.c @@ -136,7 +136,7 @@ char *basilisk_respond_MSG(struct supernet_info *myinfo,char *CMD,void *addr,cha { int32_t keylen; uint8_t key[64]; keylen = basilisk_messagekey(key,hash,valsobj); - char str[65]; printf("%s channel.%u msgid.%u datalen.%d\n",bits256_str(str,hash),juint(valsobj,"channel"),juint(valsobj,"msgid"),datalen); + //char str[65]; printf("%s channel.%u msgid.%u datalen.%d\n",bits256_str(str,hash),juint(valsobj,"channel"),juint(valsobj,"msgid"),datalen); return(basilisk_respond_getmessage(myinfo,key,keylen)); } diff --git a/basilisk/basilisk_bitcoin.c b/basilisk/basilisk_bitcoin.c index a717a5b60..dff1e3779 100755 --- a/basilisk/basilisk_bitcoin.c +++ b/basilisk/basilisk_bitcoin.c @@ -310,6 +310,7 @@ char *basilisk_valuestr(struct iguana_info *coin,char *coinaddr,uint64_t value,i jadd64bits(retjson,"satoshis",value); jaddnum(retjson,"value",dstr(value)); jaddnum(retjson,"height",height); + jaddnum(retjson,"numconfirms",coin->blocks.hwmchain.height - height); jaddbits256(retjson,"txid",txid); jaddnum(retjson,"vout",vout); jaddstr(retjson,"coin",coin->symbol); diff --git a/basilisk/basilisk_swap.c b/basilisk/basilisk_swap.c index 5a78fe3ac..e93c26ef3 100755 --- a/basilisk/basilisk_swap.c +++ b/basilisk/basilisk_swap.c @@ -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 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