From e65f7a9e21b3800322f4ba76bc7da9359830c9bc Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 25 May 2016 02:50:10 -0500 Subject: [PATCH] test --- iguana/iguana_instantdex.c | 3 ++- iguana/swaps/iguana_BTCswap.c | 14 ++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/iguana/iguana_instantdex.c b/iguana/iguana_instantdex.c index dacdaa14a..39f43704b 100755 --- a/iguana/iguana_instantdex.c +++ b/iguana/iguana_instantdex.c @@ -421,12 +421,13 @@ char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *o extralen = (int32_t)sizeof(swap->deck); serflag = 1; } - else if ( swap->otherverifiedcut == 0 && swap->otherchoosei >= 0 && bits256_nonz(swap->privkeys[swap->otherchoosei]) == 0 ) + else if ( swap->otherverifiedcut == 0 && bits256_nonz(swap->privkeys[swap->otherchoosei]) == 0 ) { extraser = swap->privkeys[0].bytes; extralen = (int32_t)sizeof(swap->privkeys); serflag = 2; } else serflag = 0; + printf("serflag.%d\n",serflag); datalen = (int32_t)slen + extralen + olen; msg = calloc(1,datalen + sizeof(*msg)); for (i=0; icmd); i++) diff --git a/iguana/swaps/iguana_BTCswap.c b/iguana/swaps/iguana_BTCswap.c index 0db091fc7..fcdef6ebc 100755 --- a/iguana/swaps/iguana_BTCswap.c +++ b/iguana/swaps/iguana_BTCswap.c @@ -821,12 +821,10 @@ cJSON *instantdex_parseargjson(struct supernet_info *myinfo,struct exchange_info cJSON *BTC_checkdeckfunc(struct supernet_info *myinfo,struct exchange_info *exchange,struct bitcoin_swapinfo *swap,cJSON *argjson,cJSON *newjson,uint8_t **serdatap,int32_t *serdatalenp) { - *serdatap = 0, *serdatalenp = 0; struct iguana_info *coin = iguana_coinfind("BTC"); - if ( coin != 0 ) - { - if ( swap->choosei >= 0 )//&& swap->otherchoosei >= 0 ) - jaddstr(newjson,"virtevent","gotdeck"); - } + *serdatap = 0, *serdatalenp = 0; + if ( swap->choosei >= 0 )//&& swap->otherchoosei >= 0 ) + jaddstr(newjson,"virtevent","gotdeck"); + else printf("no choosei yet\n"); return(newjson); } @@ -922,7 +920,7 @@ cJSON *BTC_waitpaymentfunc(struct supernet_info *myinfo,struct exchange_info *ex { if ( instantdex_isbob(swap) == 0 ) { - if ( instantdex_paymentverify(myinfo,iguana_coinfind(swap->mine.offer.base),swap,argjson,0) == 0 ) + if ( instantdex_paymentverify(myinfo,swap->altcoin,swap,argjson,0) == 0 ) jaddstr(newjson,"virtevent","payfound"); } //else jaddstr(newjson,"virtevent","payfound"); } @@ -995,7 +993,7 @@ struct instantdex_stateinfo *BTC_initFSM(int32_t *n) instantdex_addevent(s,*n,"BTC_idle","BTCoffer","poll","BTC_waitdeck"); // send deck + Chose instantdex_addevent(s,*n,"BTC_waitdeck","gotdeck","havedeck","BTC_gotdeck"); // virt event instantdex_addevent(s,*n,"BTC_waitdeck","havedeck","poll","BTC_waitdeck"); // other side gotdeck - instantdex_addevent(s,*n,"BTC_waitdeck","sentpriv","poll","BTC_waitdeck"); + instantdex_addevent(s,*n,"BTC_waitdeck","sentpriv","sentpriv","BTC_waitdeck"); instantdex_addevent(s,*n,"BTC_waitdeck","poll","sentpriv","BTC_waitdeck"); // to goto BTC_waitfee, both must have sent/recv deck and Chosen and verified cut and choose