Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
04550bdced
  1. 2
      iguana/iguana_instantdex.c
  2. 42
      iguana/swaps/iguana_BTCswap.c

2
iguana/iguana_instantdex.c

@ -1138,7 +1138,7 @@ char *instantdex_parse(struct supernet_info *myinfo,struct instantdex_msghdr *ms
memset(&A,0,sizeof(A)); memset(&A,0,sizeof(A));
if ( j64bits(argjson,"id") != orderhash.txid ) if ( j64bits(argjson,"id") != orderhash.txid )
{ {
printf("orderhash %llu mismatch id.%llu\n",(long long)orderhash.txid,(long long)j64bits(argjson,"id")); printf("orderhash %llu (%s)\n",(long long)orderhash.txid,jprint(argjson,0));
return(clonestr("{\"error\":\"orderhash mismatch\"}")); return(clonestr("{\"error\":\"orderhash mismatch\"}"));
} }
A.offer = *offer; A.offer = *offer;

42
iguana/swaps/iguana_BTCswap.c

@ -671,7 +671,11 @@ cJSON *BOB_waitfeefunc(struct supernet_info *myinfo,struct exchange_info *exchan
jaddstr(newjson,"deposit",swap->deposit->txbytes); jaddstr(newjson,"deposit",swap->deposit->txbytes);
jaddbits256(newjson,"deposittxid",swap->deposit->txid); jaddbits256(newjson,"deposittxid",swap->deposit->txid);
} }
else jaddstr(newjson,"error","couldnt create paymenttx"); else
{
free_json(newjson);
newjson = 0;
}
return(newjson); return(newjson);
} }
return(0); return(0);
@ -704,7 +708,11 @@ cJSON *BOB_waitaltconfirmfunc(struct supernet_info *myinfo,struct exchange_info
jaddstr(newjson,"payment",swap->payment->txbytes); jaddstr(newjson,"payment",swap->payment->txbytes);
jaddbits256(newjson,"paymenttxid",swap->payment->txid); jaddbits256(newjson,"paymenttxid",swap->payment->txid);
} }
else jaddstr(newjson,"error","couldnt create paymenttx"); else
{
free_json(newjson);
newjson = 0;
}
return(newjson); return(newjson);
} }
return(0); return(0);
@ -719,7 +727,13 @@ cJSON *BTC_waitprivsfunc(struct supernet_info *myinfo,struct exchange_info *exch
{ {
jaddstr(newjson,"feetx",swap->myfee->txbytes); jaddstr(newjson,"feetx",swap->myfee->txbytes);
jaddbits256(newjson,"feetxid",swap->myfee->txid); jaddbits256(newjson,"feetxid",swap->myfee->txid);
} else printf("error generating feetx\n"); }
else
{
printf("error generating feetx\n");
free_json(newjson);
newjson = 0;
}
return(newjson); return(newjson);
} }
@ -734,7 +748,9 @@ cJSON *ALICE_waitfeefunc(struct supernet_info *myinfo,struct exchange_info *exch
retstr = swap->otherfee->txbytes; retstr = swap->otherfee->txbytes;
jaddstr(newjson,"feefound",retstr); jaddstr(newjson,"feefound",retstr);
return(newjson); return(newjson);
} else return(0); }
free_json(newjson);
return(0);
} }
cJSON *ALICE_waitdepositfunc(struct supernet_info *myinfo,struct exchange_info *exchange,struct bitcoin_swapinfo *swap,cJSON *argjson,cJSON *newjson,uint8_t **serdatap,int32_t *serdatalenp) cJSON *ALICE_waitdepositfunc(struct supernet_info *myinfo,struct exchange_info *exchange,struct bitcoin_swapinfo *swap,cJSON *argjson,cJSON *newjson,uint8_t **serdatap,int32_t *serdatalenp)
@ -754,7 +770,12 @@ cJSON *ALICE_waitdepositfunc(struct supernet_info *myinfo,struct exchange_info *
// broadcast altpayment // broadcast altpayment
jaddstr(newjson,"altpayment",swap->altpayment->txbytes); jaddstr(newjson,"altpayment",swap->altpayment->txbytes);
jaddbits256(newjson,"altpaymenttxid",swap->altpayment->txid); jaddbits256(newjson,"altpaymenttxid",swap->altpayment->txid);
} else return(cJSON_Parse("{\"error\":\"couldnt create altpayment\"}")); }
else
{
free_json(newjson);
newjson = 0;
}
} }
return(newjson); return(newjson);
} }
@ -773,7 +794,9 @@ cJSON *ALICE_waitconfirmsfunc(struct supernet_info *myinfo,struct exchange_info
// if bobreclaimed is there, then reclaim altpayment // if bobreclaimed is there, then reclaim altpayment
printf("search for Bob's reclaim in blockchain\n"); printf("search for Bob's reclaim in blockchain\n");
return(newjson); return(newjson);
} else return(0); }
free_json(newjson);
return(0);
} }
cJSON *ALICE_checkbobreclaimfunc(struct supernet_info *myinfo,struct exchange_info *exchange,struct bitcoin_swapinfo *swap,cJSON *argjson,cJSON *newjson,uint8_t **serdatap,int32_t *serdatalenp) cJSON *ALICE_checkbobreclaimfunc(struct supernet_info *myinfo,struct exchange_info *exchange,struct bitcoin_swapinfo *swap,cJSON *argjson,cJSON *newjson,uint8_t **serdatap,int32_t *serdatalenp)
@ -790,7 +813,9 @@ cJSON *ALICE_checkbobreclaimfunc(struct supernet_info *myinfo,struct exchange_in
// if bobreclaimed is there, then reclaim altpayment // if bobreclaimed is there, then reclaim altpayment
printf("search for Bob's reclaim in blockchain\n"); printf("search for Bob's reclaim in blockchain\n");
return(newjson); return(newjson);
} else return(0); }
free_json(newjson);
return(0);
} }
cJSON *BTC_cleanupfunc(struct supernet_info *myinfo,struct exchange_info *exchange,struct bitcoin_swapinfo *swap,cJSON *argjson,cJSON *newjson,uint8_t **serdatap,int32_t *serdatalenp) cJSON *BTC_cleanupfunc(struct supernet_info *myinfo,struct exchange_info *exchange,struct bitcoin_swapinfo *swap,cJSON *argjson,cJSON *newjson,uint8_t **serdatap,int32_t *serdatalenp)
@ -1010,7 +1035,8 @@ char *instantdex_statemachine(struct instantdex_stateinfo *states,int32_t numsta
free_json(origjson); free_json(origjson);
if ( strcmp("poll",state->events[i].sendcmd) == 0 ) if ( strcmp("poll",state->events[i].sendcmd) == 0 )
{ {
return(instantdex_sendcmd(myinfo,&swap->mine.offer,newjson,state->events[i].sendcmd,myinfo->myaddr.persistent,0,serdata,serdatalen,0)); printf("POLL for pending tx expected.(%s)\n",swap->expectedcmdstr);
//return(instantdex_sendcmd(myinfo,&swap->mine.offer,newjson,state->events[i].sendcmd,myinfo->myaddr.persistent,0,serdata,serdatalen,0));
} }
else else
{ {

Loading…
Cancel
Save