Browse Source

Test

etomic
jl777 8 years ago
parent
commit
19ff3b27d7
  1. 30
      iguana/exchanges/LP_utxos.c

30
iguana/exchanges/LP_utxos.c

@ -352,24 +352,9 @@ struct LP_utxoinfo *LP_utxoadd(int32_t iambob,int32_t mypubsock,char *symbol,bit
return(0);
}
destaddr2[0] = 0;
if ( (val= LP_txvalue(destaddr,symbol,txid,vout)) != value || (val2= LP_txvalue(destaddr2,symbol,txid2,vout2)) != value2 || strcmp(destaddr,destaddr2) != 0 || strcmp(coinaddr,destaddr) != 0 )
{
printf("utxoadd mismatch %s/v%d (%s %.8f) + %s/v%d (%s %.8f) != %s %.8f %.8f\n",bits256_str(str,txid),vout,destaddr,dstr(val),bits256_str(str2,txid2),vout2,destaddr2,dstr(val2),coinaddr,dstr(value),dstr(value2));
return(0);
}
if ( iambob != 0 && value2 < 9 * (value >> 3) + 100000 ) // big txfee padding
tmpsatoshis = (((value2 - 100000) / 9) << 3);
else tmpsatoshis = value;
if ( LP_iseligible(iambob,symbol,txid,vout,tmpsatoshis,txid2,vout2) <= 0 )
{
printf("utxoadd got spent txid value %.8f, value2 %.8f, tmpsatoshis %.8f\n",dstr(value),dstr(value2),dstr(tmpsatoshis));
return(0);
}
if ( (selector= LP_mempool_vinscan(&spendtxid,&spendvini,symbol,txid,vout,txid2,vout2)) >= 0 )
{
printf("utxoadd selector.%d in mempool %s vini.%d",selector,bits256_str(str,spendtxid),spendvini);
return(0);
}
if ( (utxo= LP_utxofinds(iambob,txid,vout,txid2,vout2)) != 0 )
{
if ( 0 && LP_ismine(utxo) == 0 )
@ -388,6 +373,21 @@ struct LP_utxoinfo *LP_utxoadd(int32_t iambob,int32_t mypubsock,char *symbol,bit
}
else
{
if ( (val= LP_txvalue(destaddr,symbol,txid,vout)) != value || (val2= LP_txvalue(destaddr2,symbol,txid2,vout2)) != value2 || strcmp(destaddr,destaddr2) != 0 || strcmp(coinaddr,destaddr) != 0 )
{
printf("utxoadd mismatch %s/v%d (%s %.8f) + %s/v%d (%s %.8f) != %s %.8f %.8f\n",bits256_str(str,txid),vout,destaddr,dstr(val),bits256_str(str2,txid2),vout2,destaddr2,dstr(val2),coinaddr,dstr(value),dstr(value2));
return(0);
}
if ( LP_iseligible(iambob,symbol,txid,vout,tmpsatoshis,txid2,vout2) <= 0 )
{
printf("utxoadd got spent txid value %.8f, value2 %.8f, tmpsatoshis %.8f\n",dstr(value),dstr(value2),dstr(tmpsatoshis));
return(0);
}
if ( (selector= LP_mempool_vinscan(&spendtxid,&spendvini,symbol,txid,vout,txid2,vout2)) >= 0 )
{
printf("utxoadd selector.%d in mempool %s vini.%d",selector,bits256_str(str,spendtxid),spendvini);
return(0);
}
utxo = calloc(1,sizeof(*utxo));
utxo->S.profitmargin = profitmargin;
utxo->pubkey = pubkey;

Loading…
Cancel
Save