Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
864058d65c
  1. 6
      iguana/iguana_instantdex.c
  2. 5
      iguana/swaps/iguana_BTCswap.c

6
iguana/iguana_instantdex.c

@ -119,10 +119,8 @@ struct instantdex_event *instantdex_addevent(struct instantdex_stateinfo *states
struct instantdex_stateinfo *nextstate,*state;
if ( (state= instantdex_statefind(states,numstates,statename)) != 0 && (nextstate= instantdex_statefind(states,numstates,nextstatename)) != 0 )
{
printf("realloc %p\n",state->events);
if ( (state->events= realloc(state->events,(state->numevents + 1) * sizeof(*state->events))) != 0 )
{
printf("newptr.%p\n",state->events);
memset(&state->events[state->numevents],0,sizeof(state->events[state->numevents]));
strcpy(state->events[state->numevents].cmdstr,cmdstr);
if ( sendcmd != 0 )
@ -469,7 +467,7 @@ struct instantdex_accept *instantdex_offerfind(struct supernet_info *myinfo,stru
//printf("find cmps %d %d %d %d %d %d\n",strcmp(base,"*") == 0,strcmp(base,ap->offer.base) == 0,strcmp(rel,"*") == 0,strcmp(rel,ap->offer.rel) == 0,orderid == 0,orderid == ap->orderid);
if ( (strcmp(base,"*") == 0 || strcmp(base,ap->offer.base) == 0) && (strcmp(rel,"*") == 0 || strcmp(rel,ap->offer.rel) == 0) && (orderid == 0 || orderid == ap->orderid) )
{
printf("found match.%p\n",ap);
//printf("found match.%p\n",ap);
if ( requeue == 0 && retap != 0 )
queue_enqueue("acceptableQ",&exchange->acceptableQ,&retap->DL,0);
retap = ap;
@ -487,7 +485,7 @@ struct instantdex_accept *instantdex_offerfind(struct supernet_info *myinfo,stru
}
if ( ap != retap || requeue != 0 )
{
printf("requeue.%p\n",ap);
//printf("requeue.%p\n",ap);
queue_enqueue("acceptableQ",&exchange->acceptableQ,&ap->DL,0);
}
} else free(ap);

5
iguana/swaps/iguana_BTCswap.c

@ -428,7 +428,7 @@ struct instantdex_stateinfo *BTC_initFSM(int32_t *n)
s = instantdex_statecreate(s,n,"BTC_cleanup",BOB_processfunc,0,0,0);
s = instantdex_statecreate(s,n,"BOB_claimdeposit",BOB_processfunc,0,0,0);
s = instantdex_statecreate(s,n,"ALICE_reclaim",BOB_processfunc,0,0,0);
s = instantdex_statecreate(s,n,"BOB_sentoffer",BOB_processfunc,0,"BTC_cleanup",0);
s = instantdex_statecreate(s,n,"BOB_sentprivs",BOB_processfunc,0,"BTC_cleanup",0);
s = instantdex_statecreate(s,n,"BOB_gotoffer",BOB_processfunc,0,"BTC_cleanup",0);
@ -449,6 +449,9 @@ struct instantdex_stateinfo *BTC_initFSM(int32_t *n)
s = instantdex_statecreate(s,n,"ALICE_sentalt",ALICE_processfunc,0,"BTC_claimdeposit",0);
s = instantdex_statecreate(s,n,"ALICE_waitconfirms",ALICE_processfunc,0,"BTC_claimdeposit",0);
s = instantdex_statecreate(s,n,"BOB_sentpayment",BOB_processfunc,0,"BTC_claimdeposit",0);
s = instantdex_statecreate(s,n,"ALICE_claimedbtc",BOB_processfunc,0,0,0);
s = instantdex_statecreate(s,n,"BOB_claimedalt",BOB_processfunc,0,0,0);
// events
instantdex_addevent(s,*n,"BOB_sentoffer","BTCchose","BTCprivs","BOB_sentprivs");

Loading…
Cancel
Save