From 91420d8f7f0e3a04458b86428c509b4fbe903841 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 12 Feb 2016 12:40:52 -0300 Subject: [PATCH] test --- iguana/swaps/iguana_BTCswap.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/iguana/swaps/iguana_BTCswap.c b/iguana/swaps/iguana_BTCswap.c index a3b92b69c..54ad006f8 100755 --- a/iguana/swaps/iguana_BTCswap.c +++ b/iguana/swaps/iguana_BTCswap.c @@ -506,7 +506,7 @@ char *instantdex_BTCswap(struct supernet_info *myinfo,struct exchange_info *exch if ( swap == 0 && strcmp(cmdstr,"offer") != 0 ) return(clonestr("{\"error\":\"instantdex_BTCswap no swap info after offer\"}")); printf("T.%d [%d] got offer.(%s/%s) %.8f vol %.8f %llu offerside.%d offerdir.%d swap.%p decksize.%ld\n",bits256_cmp(traderpub,myinfo->myaddr.persistent),swap!=0?swap->state:-1,A->offer.base,A->offer.rel,dstr(A->offer.price64),dstr(A->offer.basevolume64),(long long)A->orderid,A->offer.myside,A->offer.acceptdir,A->info,sizeof(swap->deck)); - if ( strcmp(cmdstr,"offer") == 0 ) // sender is Bob, receiver is network (Alice) + if ( strcmp(cmdstr,"offer") == 0 && A->info == 0 ) // sender is Bob, receiver is network (Alice) { if ( A->offer.expiration < (time(NULL) + INSTANTDEX_DURATION) ) return(clonestr("{\"error\":\"instantdex_BTCswap offer too close to expiration\"}")); @@ -526,14 +526,16 @@ char *instantdex_BTCswap(struct supernet_info *myinfo,struct exchange_info *exch return(clonestr("{\"error\":\"instantdex_BTCswap offer null newjson\"}")); else { - //printf("NEWJSON.(%s)\n",jprint(newjson,0)); instantdex_pendingnotice(myinfo,exchange,ap,A); if ( (retstr= instantdex_choosei(swap,argjson,newjson,serdata,datalen)) != 0 ) { - printf("Choosei.%s\n",retstr); return(retstr); } - else return(instantdex_sendcmd(myinfo,&A->offer,newjson,"BTCstep1",traderpub,INSTANTDEX_HOPS,swap->deck,sizeof(swap->deck))); + else + { + printf("Choosei.%s\n",retstr); + return(instantdex_sendcmd(myinfo,&A->offer,newjson,"BTCstep1",traderpub,INSTANTDEX_HOPS,swap->deck,sizeof(swap->deck))); + } } } }