Browse Source

Test

etomic
jl777 8 years ago
parent
commit
f996a6d4a7
  1. 2
      iguana/exchanges/LP_commands.c
  2. 11
      iguana/exchanges/LP_include.h
  3. 9
      iguana/exchanges/LP_nativeDEX.c
  4. 7
      iguana/exchanges/LP_swap.c

2
iguana/exchanges/LP_commands.c

@ -426,7 +426,7 @@ int32_t LP_command(struct LP_peerinfo *mypeer,int32_t pubsock,cJSON *argjson,uin
jaddnum(retjson,"quoteid",R.quoteid);
retstr = jprint(retjson,1);
LP_send(pubsock,retstr,1);
utxo->swap = LP_swapinit(1,0,privkey,&R);
utxo->swap = LP_swapinit(1,0,privkey,&R,&Q);
}
else
{

11
iguana/exchanges/LP_include.h

@ -199,6 +199,15 @@ struct basilisk_swap
};
struct LP_quoteinfo
{
struct basilisk_request R;
bits256 srchash,desthash,txid,txid2,desttxid,privkey;
uint64_t satoshis,satoshis2,txfee,destsatoshis,desttxfee,change;
uint32_t timestamp,quotetime; int32_t vout,vout2,destvout,pair;
char srccoin[16],coinaddr[64],destcoin[16],destaddr[64];
};
static struct bitcoin_opcode { UT_hash_handle hh; uint8_t opcode,flags,stackitems; int8_t extralen; } *OPTABLE; static char *OPCODES[0x100]; static int32_t OPCODELENS[0x100];
#define SIGHASH_ALL 1
@ -470,7 +479,7 @@ enum opcodetype
void basilisk_dontforget_update(struct basilisk_swap *swap,struct basilisk_rawtx *rawtx);
uint32_t basilisk_requestid(struct basilisk_request *rp);
uint32_t basilisk_quoteid(struct basilisk_request *rp);
struct basilisk_swap *LP_swapinit(int32_t iambob,int32_t optionduration,bits256 privkey,struct basilisk_request *rp);
struct basilisk_swap *LP_swapinit(int32_t iambob,int32_t optionduration,bits256 privkey,struct basilisk_request *rp,struct LP_quoteinfo *qp);
char *bitcoind_passthru(char *coinstr,char *serverport,char *userpass,char *method,char *params);
struct iguana_info *LP_coinfind(char *symbol);
void *curl_post(void **cHandlep,char *url,char *userpass,char *postfields,char *hdr0,char *hdr1,char *hdr2,char *hdr3);

9
iguana/exchanges/LP_nativeDEX.c

@ -58,15 +58,6 @@ struct LP_utxoinfo
uint16_t port;
} *LP_utxoinfos;
struct LP_quoteinfo
{
struct basilisk_request R;
bits256 srchash,desthash,txid,txid2,desttxid,privkey;
uint64_t satoshis,satoshis2,txfee,destsatoshis,desttxfee,change;
uint32_t timestamp,quotetime; int32_t vout,vout2,destvout,pair;
char srccoin[16],coinaddr[64],destcoin[16],destaddr[64];
};
struct LP_cacheinfo
{
UT_hash_handle hh;

7
iguana/exchanges/LP_swap.c

@ -538,7 +538,7 @@ void LP_aliceloop(void *_qp)
maxlen = 1024*1024 + sizeof(*swap);
data = malloc(maxlen);
expiration = (uint32_t)time(NULL) + 10;
swap = LP_swapinit(0,0,qp->privkey,&qp->R);
swap = LP_swapinit(0,0,qp->privkey,&qp->R,qp);
if ( swap != 0 )
{
if ( LP_sendwait("pubkeys",10,qp->pair,swap,data,maxlen,LP_pubkeys_verify,LP_pubkeys_data) < 0 )
@ -977,7 +977,7 @@ struct basilisk_swap *bitcoin_swapinit(bits256 privkey,uint8_t *pubkey33,bits256
return(swap);
}
struct basilisk_swap *LP_swapinit(int32_t iambob,int32_t optionduration,bits256 privkey,struct basilisk_request *rp)
struct basilisk_swap *LP_swapinit(int32_t iambob,int32_t optionduration,bits256 privkey,struct basilisk_request *rp,struct LP_quoteinfo *qp)
{
struct basilisk_swap *swap; bits256 pubkey25519; uint8_t pubkey33[33];
swap = calloc(1,sizeof(*swap));
@ -996,6 +996,9 @@ struct basilisk_swap *LP_swapinit(int32_t iambob,int32_t optionduration,bits256
free(swap);
swap = 0;
}
swap->bobpayment.utxotxid = qp->txid, swap->bobpayment.utxovout = qp->vout;
swap->bobdeposit.utxotxid = qp->txid2, swap->bobdeposit.utxovout = qp->vout2;
swap->alicepayment.utxotxid = qp->desttxid, swap->alicepayment.utxovout = qp->destvout;
return(swap);
}

Loading…
Cancel
Save