From 6f85f0d480c25cf1491823c0011cfd262283562d Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 22 May 2016 12:25:10 -0500 Subject: [PATCH] test --- iguana/iguana_instantdex.c | 2 ++ iguana/swaps/iguana_BTCswap.c | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/iguana/iguana_instantdex.c b/iguana/iguana_instantdex.c index 7d07b43bf..29a490dee 100755 --- a/iguana/iguana_instantdex.c +++ b/iguana/iguana_instantdex.c @@ -389,6 +389,8 @@ bits256 instantdex_rwoffer(int32_t rwflag,int32_t *lenp,uint8_t *serialized,stru char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *offer,cJSON *argjson,char *cmdstr,bits256 desthash,int32_t hops,void *extraser,int32_t extralen,struct iguana_peer *addr) { char *reqstr,*hexstr,*retstr; struct instantdex_msghdr *msg; bits256 orderhash; struct iguana_info *coin; int32_t i,olen,slen,datalen,max=-1; uint8_t serialized[sizeof(*offer) + sizeof(struct iguana_msghdr) + 4096 + INSTANTDEX_DECKSIZE*33]; uint64_t nxt64bits; + if ( strcmp(cmdstr,"poll") == 0 ) + return(clonestr("{\"result\":\"skip sending poll\"}")); category_subscribe(myinfo,myinfo->instantdex_category,GENESIS_PUBKEY); jaddstr(argjson,"cmd",cmdstr); jaddstr(argjson,"agent","SuperNET"); diff --git a/iguana/swaps/iguana_BTCswap.c b/iguana/swaps/iguana_BTCswap.c index 91afc38ca..e12d6ba78 100755 --- a/iguana/swaps/iguana_BTCswap.c +++ b/iguana/swaps/iguana_BTCswap.c @@ -949,23 +949,25 @@ struct instantdex_stateinfo *BTC_initFSM(int32_t *n) // to reach sentprivs, all paths must have sent/recv deck and Chose and verified cut and choose s = instantdex_statecreate(s,n,"BOB_sentprivs",BTC_waitprivsfunc,0,"BTC_cleanup",0,0); instantdex_addevent(s,*n,"BOB_sentprivs","BTCprivs","poll","BOB_waitfee"); - instantdex_addevent(s,*n,"BOB_sentprivs","BTCdeckC","BTCprivs","BOB_waitfee"); + instantdex_addevent(s,*n,"BOB_sentprivs","BTCdeckC","BTCprivs","BOB_sentprivs"); instantdex_addevent(s,*n,"BOB_sentprivs","poll","BTCdeckC","BOB_sentprivs"); s = instantdex_statecreate(s,n,"ALICE_sentprivs",BTC_waitprivsfunc,0,"BTC_cleanup",0,0); instantdex_addevent(s,*n,"ALICE_sentprivs","BTCprivs","poll","Alice_waitfee"); - instantdex_addevent(s,*n,"ALICE_sentprivs","poll","poll","ALICE_sentprivs"); + instantdex_addevent(s,*n,"ALICE_sentprivs","BTCdeckC","BTCprivs","Alice_waitfee"); + instantdex_addevent(s,*n,"ALICE_sentprivs","poll","BTCdeckC","ALICE_sentprivs"); // [BLOCKING: fee] Bob waits for fee and sends deposit when it appears s = instantdex_statecreate(s,n,"BOB_waitfee",BOB_waitfeefunc,0,"BTC_cleanup",0,0); instantdex_addevent(s,*n,"BOB_waitfee","feefound","BTCdeptx","BOB_sentdeposit"); - instantdex_addevent(s,*n,"BOB_waitfee","poll","poll","BOB_waitfee"); + instantdex_addevent(s,*n,"BOB_waitfee","BTCdeckC","BTCprivs","BOB_waitfee"); + instantdex_addevent(s,*n,"BOB_waitfee","BTCprivs","poll","BOB_waitfee"); // [BLOCKING: fee and deposit] Alice waits for fee and then waits for deposit to confirm and sends altpayment s = instantdex_statecreate(s,n,"Alice_waitfee",ALICE_waitfeefunc,0,"BTC_cleanup",0,0); instantdex_addevent(s,*n,"Alice_waitfee","feefound","poll","ALICE_waitdeposit"); instantdex_addevent(s,*n,"Alice_waitfee","BTCdeckC","BTCprivs","Alice_waitfee"); - instantdex_addevent(s,*n,"Alice_waitfee","poll","BTCdeckC","Alice_waitfee"); + instantdex_addevent(s,*n,"Alice_waitfee","BTCprivs","poll","Alice_waitfee"); s = instantdex_statecreate(s,n,"ALICE_waitdeposit",ALICE_waitdepositfunc,0,"BTC_cleanup",0,0); instantdex_addevent(s,*n,"ALICE_waitdeposit","depfound","BTCalttx","ALICE_sentalt");