Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
07c47bcd6c
  1. 57
      iguana/swaps/iguana_BTCswap.c

57
iguana/swaps/iguana_BTCswap.c

@ -441,34 +441,7 @@ int32_t instantdex_pubkeyargs(struct supernet_info *myinfo,struct bitcoin_swapin
}
n++;
}
if ( (swap->otherhavestate & INSTANTDEX_ORDERSTATE_HAVEOTHERFEE) == 0 && swap->myfee != 0 )
{
jaddbits256(newjson,"feetxid",swap->myfee->txid);
jaddstr(newjson,"feetx",swap->myfee->txbytes);
}
if ( instantdex_isbob(swap) != 0 )
{
if ( (swap->otherhavestate & INSTANTDEX_ORDERSTATE_HAVEALTPAYMENT) == 0 && swap->altpayment != 0 )
{
jaddbits256(newjson,"altpaymenttxid",swap->altpayment->txid);
jaddstr(newjson,"altpayment",swap->altpayment->txbytes);
}
}
else
{
if ( (swap->otherhavestate & INSTANTDEX_ORDERSTATE_HAVEDEPOSIT) == 0 && swap->deposit != 0 )
{
jaddbits256(newjson,"deposittxid",swap->deposit->txid);
jaddstr(newjson,"deposit",swap->deposit->txbytes);
}
else if ( (swap->otherhavestate & INSTANTDEX_ORDERSTATE_HAVEPAYMENT) == 0 && swap->payment != 0 )
{
jaddbits256(newjson,"paymenttxid",swap->payment->txid);
jaddstr(newjson,"payment",swap->payment->txbytes);
}
}
jaddnum(newjson,"have",swap->havestate);
printf("got have.%x, myhave.%x\n",swap->otherhavestate,swap->havestate);
printf("got otherhave.%x, myhave.%x\n",swap->otherhavestate,swap->havestate);
if ( n > 2 || m > 2 )
{
printf("n.%d m.%d len.%d numpubs.%d\n",n,m,len,swap->numpubs);
@ -1175,6 +1148,34 @@ void instantdex_statemachine_iter(struct supernet_info *myinfo,struct exchange_i
{
//printf("send poll event\n");
newjson = jduplicate(swap->pollevent->newjson);
if ( (swap->otherhavestate & INSTANTDEX_ORDERSTATE_HAVEOTHERFEE) == 0 && swap->myfee != 0 )
{
jaddbits256(newjson,"feetxid",swap->myfee->txid);
jaddstr(newjson,"feetx",swap->myfee->txbytes);
printf("add feetx to newjson\n");
}
if ( instantdex_isbob(swap) != 0 )
{
if ( (swap->otherhavestate & INSTANTDEX_ORDERSTATE_HAVEALTPAYMENT) == 0 && swap->altpayment != 0 )
{
jaddbits256(newjson,"altpaymenttxid",swap->altpayment->txid);
jaddstr(newjson,"altpayment",swap->altpayment->txbytes);
}
}
else
{
if ( (swap->otherhavestate & INSTANTDEX_ORDERSTATE_HAVEDEPOSIT) == 0 && swap->deposit != 0 )
{
jaddbits256(newjson,"deposittxid",swap->deposit->txid);
jaddstr(newjson,"deposit",swap->deposit->txbytes);
}
else if ( (swap->otherhavestate & INSTANTDEX_ORDERSTATE_HAVEPAYMENT) == 0 && swap->payment != 0 )
{
jaddbits256(newjson,"paymenttxid",swap->payment->txid);
jaddstr(newjson,"payment",swap->payment->txbytes);
}
}
jaddnum(newjson,"have",swap->havestate);
if ( (str= instantdex_statemachine(BTC_states,BTC_numstates,myinfo,exchange,swap,"poll",swap->pollevent->argjson,newjson,swap->pollevent->serdata,swap->pollevent->serdatalen)) != 0 )
free(str);
free_json(newjson);

Loading…
Cancel
Save