Browse Source

Test

etomic
jl777 8 years ago
parent
commit
2b2173daab
  1. 5
      iguana/exchanges/LP_commands.c
  2. 8
      iguana/exchanges/LP_transaction.c

5
iguana/exchanges/LP_commands.c

@ -113,9 +113,8 @@ int32_t LP_quoteparse(struct LP_quoteinfo *qp,cJSON *argjson)
qp->desthash = jbits256(argjson,"desthash"); qp->desthash = jbits256(argjson,"desthash");
if ( (qp->satoshis= j64bits(argjson,"satoshis")) == 0 ) if ( (qp->satoshis= j64bits(argjson,"satoshis")) == 0 )
qp->satoshis = SATOSHIDEN * jdouble(argjson,"value"); qp->satoshis = SATOSHIDEN * jdouble(argjson,"value");
if ( (qp->satoshis2= j64bits(argjson,"satoshis2")) == 0 ) if ( (qp->destsatoshis= j64bits(argjson,"destsatoshis")) == 0 )
qp->satoshis = SATOSHIDEN * jdouble(argjson,"value2"); qp->destsatoshis = SATOSHIDEN * jdouble(argjson,"value2");
qp->destsatoshis = j64bits(argjson,"destsatoshis");
qp->change = SATOSHIDEN * jdouble(argjson,"change"); qp->change = SATOSHIDEN * jdouble(argjson,"change");
qp->txfee = j64bits(argjson,"txfee"); qp->txfee = j64bits(argjson,"txfee");
qp->desttxfee = j64bits(argjson,"desttxfee"); qp->desttxfee = j64bits(argjson,"desttxfee");

8
iguana/exchanges/LP_transaction.c

@ -639,6 +639,12 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch
if ( addrtype == p2shtype ) if ( addrtype == p2shtype )
spendlen = bitcoin_p2shspend(spendscript,0,rmd160); spendlen = bitcoin_p2shspend(spendscript,0,rmd160);
else spendlen = bitcoin_standardspend(spendscript,0,rmd160); else spendlen = bitcoin_standardspend(spendscript,0,rmd160);
if ( change != 0 && strcmp(changeaddr,destaddr) == 0 )
{
printf("combine change %.8f -> %s\n",dstr(change),changeaddr);
satoshis += change;
change = 0;
}
txobj = bitcoin_txoutput(txobj,spendscript,spendlen,satoshis); txobj = bitcoin_txoutput(txobj,spendscript,spendlen,satoshis);
if ( change != 0 ) if ( change != 0 )
{ {
@ -722,7 +728,7 @@ int32_t basilisk_rawtx_sign(char *symbol,uint8_t pubtype,uint8_t p2shtype,uint8_
} }
for (iter=0; iter<2; iter++) for (iter=0; iter<2; iter++)
{ {
if ( (signedtx= basilisk_swap_bobtxspend(&dest->I.signedtxid,iter == 0 ? txfee : newtxfee,rawtx->name,symbol,pubtype,p2shtype,isPoS,wiftype,swap->ctx,privkey,privkey2,rawtx->redeemscript,rawtx->I.redeemlen,userdata,userdatalen,rawtx->utxotxid,rawtx->utxovout,dest->p2shaddr,rawtx->I.pubkey33,1,0,&destamount,rawtx->I.amount,changeaddr,vinaddr,dest->I.suppress_pubkeys)) != 0 ) if ( (signedtx= basilisk_swap_bobtxspend(&dest->I.signedtxid,iter == 0 ? txfee : newtxfee,rawtx->name,symbol,pubtype,p2shtype,isPoS,wiftype,swap->ctx,privkey,privkey2,rawtx->redeemscript,rawtx->I.redeemlen,userdata,userdatalen,rawtx->utxotxid,rawtx->utxovout,dest->I.destaddr,rawtx->I.pubkey33,1,0,&destamount,rawtx->I.amount,changeaddr,vinaddr,dest->I.suppress_pubkeys)) != 0 )
{ {
dest->I.datalen = (int32_t)strlen(signedtx) >> 1; dest->I.datalen = (int32_t)strlen(signedtx) >> 1;
if ( dest->I.datalen <= sizeof(dest->txbytes) ) if ( dest->I.datalen <= sizeof(dest->txbytes) )

Loading…
Cancel
Save