jl777 8 years ago
parent
commit
599b7cca8d
  1. 11
      basilisk/basilisk_swap.c
  2. 4
      basilisk/basilisk_tradebot.c
  3. 2
      iguana/tests/request2
  4. 4
      includes/iguana_structs.h

11
basilisk/basilisk_swap.c

@ -1201,22 +1201,12 @@ struct basilisk_swap *bitcoin_swapinit(struct supernet_info *myinfo,struct basil
swap->I.otherhash = swap->I.req.desthash; swap->I.otherhash = swap->I.req.desthash;
if ( strcmp(swap->I.req.src,swap->I.bobstr) == 0 ) if ( strcmp(swap->I.req.src,swap->I.bobstr) == 0 )
swap->I.iambob = 1; swap->I.iambob = 1;
else if ( strcmp(swap->I.req.dest,swap->I.alicestr) == 0 )
{
printf("neither bob nor alice error\n");
return(0);
}
} }
else if ( bits256_cmp(swap->I.myhash,swap->I.req.desthash) == 0 ) else if ( bits256_cmp(swap->I.myhash,swap->I.req.desthash) == 0 )
{ {
swap->I.otherhash = swap->I.req.srchash; swap->I.otherhash = swap->I.req.srchash;
if ( strcmp(swap->I.req.dest,swap->I.bobstr) == 0 ) if ( strcmp(swap->I.req.dest,swap->I.bobstr) == 0 )
swap->I.iambob = 1; swap->I.iambob = 1;
else if ( strcmp(swap->I.req.src,swap->I.alicestr) != 0 )
{
printf("neither alice nor bob error\n");
return(0);
}
} }
else else
{ {
@ -1228,7 +1218,6 @@ struct basilisk_swap *bitcoin_swapinit(struct supernet_info *myinfo,struct basil
printf("iambob.%d != %d\n",swap->I.iambob,bitcoin_coinptrs(myinfo,&bobcoin,&alicecoin,swap->I.req.src,swap->I.req.dest,swap->I.req.srchash,swap->I.req.desthash)); printf("iambob.%d != %d\n",swap->I.iambob,bitcoin_coinptrs(myinfo,&bobcoin,&alicecoin,swap->I.req.src,swap->I.req.dest,swap->I.req.srchash,swap->I.req.desthash));
return(0); return(0);
} }
if ( bits256_nonz(myinfo->persistent_priv) == 0 || (x= instantdex_pubkeyargs(myinfo,swap,2 + INSTANTDEX_DECKSIZE,myinfo->persistent_priv,swap->I.orderhash,0x02+swap->I.iambob)) != 2 + INSTANTDEX_DECKSIZE ) if ( bits256_nonz(myinfo->persistent_priv) == 0 || (x= instantdex_pubkeyargs(myinfo,swap,2 + INSTANTDEX_DECKSIZE,myinfo->persistent_priv,swap->I.orderhash,0x02+swap->I.iambob)) != 2 + INSTANTDEX_DECKSIZE )
{ {
printf("couldnt generate privkeys %d\n",x); printf("couldnt generate privkeys %d\n",x);

4
basilisk/basilisk_tradebot.c

@ -372,7 +372,11 @@ double basilisk_request_listprocess(struct supernet_info *myinfo,struct basilisk
minamount = list[0].minamount; minamount = list[0].minamount;
//printf("need to verify null quoteid is list[0] requestid.%u quoteid.%u\n",list[0].requestid,list[0].quoteid); //printf("need to verify null quoteid is list[0] requestid.%u quoteid.%u\n",list[0].requestid,list[0].quoteid);
if ( (active= basilisk_request_started(myinfo,list[0].requestid)) != 0 ) if ( (active= basilisk_request_started(myinfo,list[0].requestid)) != 0 )
{
if ( active->I.req.quoteid != 0 )
return(0.);
pendingid = active->I.req.quoteid; pendingid = active->I.req.quoteid;
}
if ( bits256_cmp(myinfo->myaddr.persistent,list[0].srchash) == 0 ) // my request if ( bits256_cmp(myinfo->myaddr.persistent,list[0].srchash) == 0 ) // my request
myrequest = 1; myrequest = 1;
for (i=0; i<n; i++) for (i=0; i<n; i++)

2
iguana/tests/request2

@ -0,0 +1,2 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"InstantDEX\",\"method\":\"request\",\"vals\":{\"source\":\"BTC\",\"amount\":0.0001,\"dest\":\"BTCD\",\"minprice\":240}}"

4
includes/iguana_structs.h

@ -563,8 +563,8 @@ struct basilisk_request
char src[8],dest[8]; char src[8],dest[8];
//char volatile_start,message[43]; //char volatile_start,message[43];
uint64_t destamount; uint64_t destamount;
int32_t profitmargin,optionhours; int32_t optionhours,profitmargin;
}; // __attribute__((packed)) } PACKEDSTRUCT;
struct basilisk_relaystatus struct basilisk_relaystatus
{ {

Loading…
Cancel
Save