jl777 7 years ago
parent
commit
b487916233
  1. 2
      iguana/exchanges/LP_ordermatch.c
  2. 10
      iguana/exchanges/LP_stats.c
  3. 2
      iguana/exchanges/LP_transaction.c
  4. 17
      iguana/exchanges/LP_utxo.c

2
iguana/exchanges/LP_ordermatch.c

@ -272,7 +272,7 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo **
struct LP_address *ap; uint64_t targetval,targetval2; int32_t m,mini; struct LP_address_utxo *up,*up2; struct LP_utxoinfo *utxo = 0;
if ( coin != 0 && (ap= LP_addressfind(coin,coinaddr)) != 0 )
{
if ( (m= LP_address_utxo_ptrs(iambob,utxos,max,ap,coinaddr)) > 1 )
if ( (m= LP_address_utxo_ptrs(coin,iambob,utxos,max,ap,coinaddr)) > 1 )
{
targetval = LP_basesatoshis(relvolume,price,txfee,desttxfee);
if ( 0 )

10
iguana/exchanges/LP_stats.c

@ -43,7 +43,7 @@ uint64_t Ridqids[128];
int32_t LP_statslog_parsequote(char *method,cJSON *lineobj)
{
int32_t i,duplicate=0; struct LP_quoteinfo Q; uint64_t ridqid;
int32_t i,destvout,feevout,duplicate=0; bits256 desttxid,feetxid; struct LP_quoteinfo Q; uint64_t ridqid;
memset(&Q,0,sizeof(Q));
if ( LP_quoteparse(&Q,lineobj) < 0 )
{
@ -52,7 +52,11 @@ int32_t LP_statslog_parsequote(char *method,cJSON *lineobj)
}
else
{
ridqid = (((uint64_t)Q.desttxid.uints[0] << 48) | ((uint64_t)Q.destvout << 32) || ((uint64_t)Q.feetxid.uints[0] << 16) | (uint32_t)Q.feevout);
desttxid = jbits256(lineobj,"desttxid");
destvout = jint(lineobj,"destvout");
feetxid = jbits256(lineobj,"feetxid");
feevout = jint(lineobj,"feevout");
ridqid = (((uint64_t)desttxid.uints[0] << 48) | ((uint64_t)destvout << 32) || ((uint64_t)feetxid.uints[0] << 16) | (uint32_t)feevout);
for (i=0; i<sizeof(Ridqids)/sizeof(*Ridqids); i++)
{
if ( Ridqids[i] == ridqid )
@ -66,7 +70,7 @@ int32_t LP_statslog_parsequote(char *method,cJSON *lineobj)
{
Ridqids[LP_numridqids % (sizeof(Ridqids)/sizeof(*Ridqids))] = ridqid;
LP_numridqids++;
char str[65]; printf("%10s ridqid.%-16llx -> %d %s/v%d\n",method,(long long)ridqid,(int32_t)(LP_numridqids % (sizeof(Ridqids)/sizeof(*Ridqids))),bits256_str(str,jbits256(lineobj,"desttxid")),jint(lineobj,"destvout"));
char str[65]; printf("%10s ridqid.%-16llx -> %d %s/v%d\n",method,(long long)ridqid,(int32_t)(LP_numridqids % (sizeof(Ridqids)/sizeof(*Ridqids))),bits256_str(str,desttxid),destvout);
}
}
return(duplicate == 0);

2
iguana/exchanges/LP_transaction.c

@ -955,7 +955,7 @@ char *LP_createrawtransaction(cJSON **txobjp,int32_t *numvinsp,struct iguana_inf
return(0);
}
memset(utxos,0,sizeof(utxos));
if ( (numutxos= LP_address_utxo_ptrs(0,utxos,max,ap,coin->smartaddr)) <= 0 )
if ( (numutxos= LP_address_utxo_ptrs(coin,0,utxos,max,ap,coin->smartaddr)) <= 0 )
{
printf("LP_createrawtransaction: address_utxo_ptrs %d, error\n",numutxos);
return(0);

17
iguana/exchanges/LP_utxo.c

@ -138,9 +138,9 @@ struct LP_utxoinfo *LP_allocated(bits256 txid,int32_t vout)
return(0);
}
int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32_t max,struct LP_address *ap,char *coinaddr)
int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_address_utxo **utxos,int32_t max,struct LP_address *ap,char *coinaddr)
{
struct LP_address_utxo *up,*tmp; int32_t n = 0;
struct LP_address_utxo *up,*tmp; struct LP_transaction *tx; cJSON *txout; int32_t n = 0;
//printf("LP_address_utxo_ptrs for (%s).(%s)\n",ap->coinaddr,coinaddr);
if ( strcmp(ap->coinaddr,coinaddr) != 0 )
printf("UNEXPECTED coinaddr mismatch (%s) != (%s)\n",ap->coinaddr,coinaddr);
@ -150,6 +150,19 @@ int32_t LP_address_utxo_ptrs(int32_t iambob,struct LP_address_utxo **utxos,int32
//char str[65]; printf("LP_address_utxo_ptrs %s n.%d %.8f %s v%d spendheight.%d allocated.%p\n",ap->coinaddr,n,dstr(up->U.value),bits256_str(str,up->U.txid),up->U.vout,up->spendheight,LP_allocated(up->U.txid,up->U.vout));
if ( up->spendheight <= 0 )
{
if ( coin->electrum == 0 )
{
if ( (txout= LP_gettxout(coin->symbol,coinaddr,up->U.txid,up->U.vout)) != 0 )
free_json(txout);
else
{
char str[65]; printf("%s %s payment %s/v%d is spent\n",coin->symbol,coinaddr,bits256_str(str,up->U.txid),up->U.vout);
up->spendheight = 1;
if ( (tx= LP_transactionfind(coin,up->U.txid)) != 0 && up->U.vout < tx->numvouts )
tx->outpoints[up->U.vout].spendheight = 1;
continue;
}
}
if ( LP_allocated(up->U.txid,up->U.vout) == 0 )
{
utxos[n++] = up;

Loading…
Cancel
Save