Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
fcd8c6f887
  1. 15
      iguana/swaps/iguana_BTCswap.c

15
iguana/swaps/iguana_BTCswap.c

@ -1018,7 +1018,7 @@ void instantdex_eventfree(struct bitcoin_eventitem *ptr)
char *instantdex_statemachine(struct instantdex_stateinfo *states,int32_t numstates,struct supernet_info *myinfo,struct exchange_info *exchange,struct bitcoin_swapinfo *swap,char *cmdstr,cJSON *argjson,cJSON *newjson,uint8_t *serdata,int32_t serdatalen)
{
uint32_t i; struct iguana_info *altcoin=0,*coinbtc=0; struct instantdex_stateinfo *state=0; char *retstr;
uint32_t i; struct iguana_info *altcoin=0,*coinbtc=0; struct instantdex_stateinfo *state=0;
if ( swap == 0 || (state= swap->state) == 0 || (coinbtc= iguana_coinfind("BTC")) == 0 || (altcoin= iguana_coinfind(swap->mine.offer.base)) == 0 )
{
printf("state.%s btc.%p altcoin.%p (%s)\n",state->name,coinbtc,altcoin,swap->mine.offer.base);
@ -1052,17 +1052,18 @@ char *instantdex_statemachine(struct instantdex_stateinfo *states,int32_t numsta
}
else
{
if ( strcmp(cmdstr,"poll") != 0 )
{
if ( swap->pollevent != 0 )
instantdex_eventfree(swap->pollevent);
swap->pollevent = instantdex_event("poll",argjson,newjson,serdata,serdatalen);
}
if ( state->events[i].sendcmd[0] != 0 )
{
if ( state->events[i].nextstateind > 1 )
{
swap->state = &states[state->events[i].nextstateind];
if ( swap->pollevent != 0 )
instantdex_eventfree(swap->pollevent);
swap->pollevent = instantdex_event("poll",argjson,newjson,serdata,serdatalen);
retstr = instantdex_sendcmd(myinfo,&swap->mine.offer,newjson,state->events[i].sendcmd,swap->othertrader,INSTANTDEX_HOPS,serdata,serdatalen,0);
free_json(newjson);
return(retstr);
return(instantdex_sendcmd(myinfo,&swap->mine.offer,newjson,state->events[i].sendcmd,swap->othertrader,INSTANTDEX_HOPS,serdata,serdatalen,0));
} else return(clonestr("{\"error\":\"instantdex_statemachine: illegal state\"}"));
} else return(clonestr("{\"result\":\"instantdex_statemachine: processed\"}"));
}

Loading…
Cancel
Save