Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
6f85f0d480
  1. 2
      iguana/iguana_instantdex.c
  2. 10
      iguana/swaps/iguana_BTCswap.c

2
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 *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; 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); category_subscribe(myinfo,myinfo->instantdex_category,GENESIS_PUBKEY);
jaddstr(argjson,"cmd",cmdstr); jaddstr(argjson,"cmd",cmdstr);
jaddstr(argjson,"agent","SuperNET"); jaddstr(argjson,"agent","SuperNET");

10
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 // 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); 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","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"); instantdex_addevent(s,*n,"BOB_sentprivs","poll","BTCdeckC","BOB_sentprivs");
s = instantdex_statecreate(s,n,"ALICE_sentprivs",BTC_waitprivsfunc,0,"BTC_cleanup",0,0); 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","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 // [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); 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","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 // [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); 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","feefound","poll","ALICE_waitdeposit");
instantdex_addevent(s,*n,"Alice_waitfee","BTCdeckC","BTCprivs","Alice_waitfee"); 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); s = instantdex_statecreate(s,n,"ALICE_waitdeposit",ALICE_waitdepositfunc,0,"BTC_cleanup",0,0);
instantdex_addevent(s,*n,"ALICE_waitdeposit","depfound","BTCalttx","ALICE_sentalt"); instantdex_addevent(s,*n,"ALICE_waitdeposit","depfound","BTCalttx","ALICE_sentalt");

Loading…
Cancel
Save