Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
34ac591bfc
  1. 9
      iguana/iguana_instantdex.c
  2. 3
      iguana/swaps/iguana_BTCswap.c

9
iguana/iguana_instantdex.c

@ -922,7 +922,7 @@ int32_t instantdex_inv2data(struct supernet_info *myinfo,struct iguana_info *coi
portable_mutex_unlock(&exchange->mutex);
if ( n > 0 )
{
printf(" nhashes\n");
printf(" nhashes for (%s)\n",addr->ipaddr);
len = iguana_inv2packet(serialized,sizeof(serialized),MSG_QUOTE,hashes,n);
//printf("Send inv2[%d] -> (%s)\n",n,addr->ipaddr);
return(iguana_queue_send(addr,0,serialized,"inv2",len,0,0));
@ -949,6 +949,7 @@ struct iguana_bundlereq *instantdex_recvquotes(struct iguana_info *coin,struct i
{
if ( (ap= instantdex_quotefind(0,coin,req->addr,quotes[i])) != 0 )
{
SETBIT(ap->peerhas,req->addr->addrind);
state = (quotes[i].txid & (~INSTANTDEX_ORDERSTATE_ORDERIDMASK));
if ( state > ap->state )
ap->state = state;
@ -1320,7 +1321,11 @@ char *instantdex_parse(struct supernet_info *myinfo,struct instantdex_msghdr *ms
strcpy(ptr->cmd,cmdstr);
ptr->newjson = newjson;
ptr->argjson = jduplicate(argjson);
memcpy(ptr->serdata,serdata,serdatalen);
if ( serdatalen != 0 )
{
memcpy(ptr->serdata,serdata,serdatalen);
ptr->serdatalen = serdatalen;
}
queue_enqueue("eventQ",&swap->eventsQ,&ptr->DL,0);
return(clonestr("{\"result\":\"updated statemachine\"}"));
//return(instantdex_statemachine(BTC_states,BTC_numstates,myinfo,exchange,swap,cmdstr,argjson,newjson,serdata,serdatalen));

3
iguana/swaps/iguana_BTCswap.c

@ -1008,7 +1008,7 @@ char *instantdex_statemachine(struct instantdex_stateinfo *states,int32_t numsta
swap->state = &states[state->timeoutind];
if ( (newjson= (*state->timeout)(myinfo,exchange,swap,argjson,newjson,&serdata,&serdatalen)) == 0 )
return(clonestr("{\"error\":\"instantdex_BTCswap null return from timeoutfunc\"}"));
return(jprint(newjson,1));
else return(jprint(newjson,1));
}
for (i=0; i<state->numevents; i++)
{
@ -1052,6 +1052,7 @@ void instantdex_statemachine_iter(struct supernet_info *myinfo,struct exchange_i
swap->myfee = instantdex_feetx(myinfo,&swap->mine,swap,iguana_coinfind("BTC"));
while ( (ptr= queue_dequeue(&swap->eventsQ,0)) != 0 )
{
printf("deQ arg.%p new.%p\n",ptr->argjson,ptr->newjson);
if ( (str= instantdex_statemachine(BTC_states,BTC_numstates,myinfo,exchange,swap,ptr->cmd,ptr->argjson,ptr->newjson,ptr->serdata,ptr->serdatalen)) != 0 )
free(str);
if ( ptr->argjson != 0 )

Loading…
Cancel
Save