diff --git a/basilisk/basilisk_swap.c b/basilisk/basilisk_swap.c index 11839f991..ed8c8ec0a 100755 --- a/basilisk/basilisk_swap.c +++ b/basilisk/basilisk_swap.c @@ -658,6 +658,7 @@ int32_t basilisk_rawtx_return(struct supernet_info *myinfo,int32_t height,struct { if ( lockinputs != 0 ) { + printf("lockinputs\n"); iguana_RTunspentslock(myinfo,rawtx->coin,vins); if ( (n= cJSON_GetArraySize(vins)) != 0 ) { @@ -684,7 +685,7 @@ int32_t basilisk_rawtx_return(struct supernet_info *myinfo,int32_t height,struct int32_t basilisk_rawtx_gen(char *str,struct supernet_info *myinfo,struct basilisk_swap *swap,int32_t iambob,int32_t lockinputs,struct basilisk_rawtx *rawtx,uint32_t locktime,uint8_t *script,int32_t scriptlen,int64_t txfee,int32_t minconf,int32_t delay) { - char *retstr,scriptstr[1024]; uint32_t basilisktag; int32_t flag,i,n,retval = -1; cJSON *valsobj,*retarray=0; struct vin_info *V; + char *retstr,scriptstr[1024],coinaddr[64]; uint32_t basilisktag; int32_t flag,i,n,retval = -1; cJSON *addresses,*valsobj,*retarray=0; struct vin_info *V; //bitcoin_address(coinaddr,rawtx->coin->chain->pubtype,myinfo->persistent_pubkey33,33); if ( rawtx->coin->changeaddr[0] == 0 ) { @@ -703,6 +704,10 @@ int32_t basilisk_rawtx_gen(char *str,struct supernet_info *myinfo,struct basilis jaddnum(valsobj,"locktime",locktime); jaddnum(valsobj,"timeout",30000); jaddnum(valsobj,"timestamp",swap->I.started+delay); + addresses = cJSON_CreateArray(); + bitcoin_address(coinaddr,rawtx->coin->chain->pubtype,myinfo->persistent_pubkey33,33); + jaddistr(addresses,coinaddr); + jadd(valsobj,"addresses",addresses); rawtx->I.locktime = locktime; //printf("%s locktime.%u\n",rawtx->name,locktime); V = calloc(256,sizeof(*V)); diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index efedf253f..b1fb89c2d 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -607,6 +607,7 @@ char *dex_response(int32_t *broadcastflagp,struct supernet_info *myinfo,struct d char *dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32_t datalen,int32_t M,char *field) { char *retstrs[64],*origretstr0 = 0; cJSON *retjson; int32_t err,i,j,max = myinfo->numdexipbits; +M = 1; memset(retstrs,0,sizeof(retstrs)); for (i=j=0; i<=max; i++) { diff --git a/iguana/iguana_payments.c b/iguana/iguana_payments.c index ed2248399..3b7883de7 100755 --- a/iguana/iguana_payments.c +++ b/iguana/iguana_payments.c @@ -169,10 +169,13 @@ int32_t iguana_RTbestunspent(struct supernet_info *myinfo,struct iguana_info *co for (above=below=i=0; i= 0 ? abovei : belowi); } @@ -436,6 +440,8 @@ char *iguana_calcrawtx(struct supernet_info *myinfo,struct iguana_info *coin,cJS free_json(array); } } + if ( unspents == 0 ) + return(0); num = max; /*unspents = calloc(max,sizeof(*unspents)); if ( (num= iguana_RTunspentslists(myinfo,coin,&avail,unspents,max,satoshis+txfee,minconf,addresses,remoteaddr)) <= 0 ) diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 2981aff11..46ec67069 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -128,13 +128,37 @@ int32_t iguana_unspentindfind(struct supernet_info *myinfo,struct iguana_info *c char *iguana_RTinputaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,struct iguana_outpoint *spentp,cJSON *vinobj) { - bits256 txid; int32_t vout,checkind,height; + bits256 txid; int32_t vout,checkind,height; cJSON *txoutjson; char *retstr; memset(spentp,0,sizeof(*spentp)); spentp->hdrsi = -1; if ( jobj(vinobj,"txid") != 0 && jobj(vinobj,"vout") != 0 ) { txid = jbits256(vinobj,"txid"); vout = jint(vinobj,"vout"); + if ( coin->FULLNODE == 0 && coin->notarychain >= 0 ) + { + if ( (retstr= _dex_gettxout(myinfo,coin->symbol,txid,vout)) != 0 ) + { + if ( (txoutjson= cJSON_Parse(retstr)) != 0 ) + { + /*if ( (value= _RTgettxout(coin,&ptr,heightp,spendlenp,spendscript,rmd160,coinaddr,txid,vout,mempool)) > 0 ) + { + outpt->ptr = ptr; + if ( valuep != 0 ) + { + *valuep = value; + outpt->value = *valuep; + } + return(coinaddr); + }*/ + spentp->value = jdouble(txoutjson,"value") * SATOSHIDEN; + free_json(txoutjson); + } + free(retstr); + return(coinaddr); + } + return(0); + } height = jint(vinobj,"height"); checkind = jint(vinobj,"checkind"); if ( (height != 0 && checkind != 0) || iguana_RTunspentindfind(myinfo,coin,spentp,coinaddr,0,0,0,&height,txid,vout,coin->bundlescount-1,0) == 0 )