Browse Source

Test

patch-3
jl777 7 years ago
parent
commit
22b738e219
  1. 9
      iguana/exchanges/LP_ordermatch.c
  2. 36
      iguana/exchanges/LP_transaction.c

9
iguana/exchanges/LP_ordermatch.c

@ -71,12 +71,12 @@ uint64_t LP_txfeecalc(struct iguana_info *coin,uint64_t txfee,int32_t txlen)
if ( txlen == 0 )
txlen = LP_AVETXSIZE;
coin->rate = LP_getestimatedrate(coin);
if ( (txfee= SATOSHIDEN * coin->rate * txlen) <= LP_MIN_TXFEE )
if ( (txfee= SATOSHIDEN * coin->rate * txlen) <= 10000 )
{
coin->rate = -1.;
coin->rate = _LP_getestimatedrate(coin);
if ( (txfee= SATOSHIDEN * coin->rate * txlen) <= LP_MIN_TXFEE )
txfee = LP_MIN_TXFEE;
if ( (txfee= SATOSHIDEN * coin->rate * txlen) <= 10000 )
txfee = 10000;
}
} else txfee = coin->txfee;
if ( txfee < LP_MIN_TXFEE )
@ -189,7 +189,10 @@ double LP_quote_validate(struct LP_utxoinfo *autxo,struct LP_utxoinfo *butxo,str
desttxfee = qp->desttxfee;
//printf("qprice %.8f <- %.8f/%.8f txfees.(%.8f %.8f) vs (%.8f %.8f)\n",qprice,dstr(qp->destsatoshis),dstr(qp->satoshis),dstr(qp->txfee),dstr(qp->desttxfee),dstr(txfee),dstr(desttxfee));
if ( qp->txfee < LP_REQUIRED_TXFEE*txfee || qp->desttxfee < LP_REQUIRED_TXFEE*desttxfee )
{
printf("error -14: txfee %.8f >= %.8f or desttxfee %.8f >= %.8f\n",dstr(qp->txfee),dstr(LP_REQUIRED_TXFEE*txfee),dstr(qp->desttxfee),dstr(LP_REQUIRED_TXFEE*desttxfee));
return(-14);
}
if ( butxo != 0 )
{
if ( qp->satoshis < (srcvalue / LP_MINVOL) || srcvalue < qp->txfee*LP_MINSIZE_TXFEEMULT )

36
iguana/exchanges/LP_transaction.c

@ -1470,42 +1470,6 @@ int32_t basilisk_rawtx_gen(void *ctx,char *str,uint32_t swapstarted,uint8_t *pub
}
free_json(argjson);
return(retval);
/*#ifdef old
int32_t retval=-1,iter; char *signedtx,*changeaddr = 0,_changeaddr[64]; struct iguana_info *coin; int64_t newtxfee=0,destamount;
char str2[65]; printf("%s rawtxgen.(%s/v%d)\n",rawtx->name,bits256_str(str2,rawtx->utxotxid),rawtx->utxovout);
if ( (coin= rawtx->coin) == 0 )
return(-1);
//return(_basilisk_rawtx_gen(str,swapstarted,pubkey33,iambob,lockinputs,rawtx,locktime,script,scriptlen,txfee,minconf,delay,privkey));
if ( changermd160 != 0 )
{
changeaddr = _changeaddr;
bitcoin_address(changeaddr,coin->taddr,coin->pubtype,changermd160,20);
//printf("changeaddr.(%s) vs destaddr.(%s)\n",changeaddr,rawtx->I.destaddr);
}
if ( strcmp(str,"myfee") == 0 && strcmp(coin->symbol,"BTC") == 0 )
txfee = LP_MIN_TXFEE;
for (iter=0; iter<2; iter++)
{
if ( (signedtx= basilisk_swap_bobtxspend(&rawtx->I.signedtxid,iter == 0 ? txfee : newtxfee,str,coin->symbol,coin->wiftaddr,coin->taddr,coin->pubtype,coin->p2shtype,coin->isPoS,coin->wiftype,ctx,privkey,0,0,0,0,0,rawtx->utxotxid,rawtx->utxovout,rawtx->I.destaddr,pubkey33,1,0,&destamount,rawtx->I.amount,changeaddr,vinaddr,rawtx->I.suppress_pubkeys,coin->zcash)) != 0 )
{
rawtx->I.datalen = (int32_t)strlen(signedtx) >> 1;
if ( rawtx->I.datalen <= sizeof(rawtx->txbytes) )
{
decode_hex(rawtx->txbytes,rawtx->I.datalen,signedtx);
rawtx->I.completed = 1;
retval = 0;
}
free(signedtx);
if ( strcmp(coin->symbol,"BTC") != 0 )
return(retval);
newtxfee = LP_txfeecalc(coin,0,rawtx->I.datalen);
printf("txfee %.8f -> newtxfee %.8f\n",dstr(txfee),dstr(newtxfee));
} else break;
if ( strcmp(str,"myfee") == 0 )
break;
}
return(retval);
#endif*/
}
int32_t basilisk_rawtx_sign(char *symbol,uint8_t wiftaddr,uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t isPoS,uint8_t wiftype,struct basilisk_swap *swap,struct basilisk_rawtx *dest,struct basilisk_rawtx *rawtx,bits256 privkey,bits256 *privkey2,uint8_t *userdata,int32_t userdatalen,int32_t ignore_cltverr,uint8_t *changermd160,char *vinaddr,int32_t zcash)

Loading…
Cancel
Save