jl777 7 years ago
parent
commit
a3267846eb
  1. 9
      iguana/exchanges/LP_transaction.c
  2. 7
      iguana/exchanges/LP_utxo.c

9
iguana/exchanges/LP_transaction.c

@ -1661,10 +1661,11 @@ char *LP_autosplit(struct iguana_info *coin)
if ( coin->electrum != 0 ) if ( coin->electrum != 0 )
balance = LP_unspents_load(coin->symbol,coin->smartaddr); balance = LP_unspents_load(coin->symbol,coin->smartaddr);
else balance = LP_RTsmartbalance(coin); else balance = LP_RTsmartbalance(coin);
printf("%s balance %.8f\n",coin->symbol,dstr(balance)); //printf("%s balance %.8f\n",coin->symbol,dstr(balance));
if ( balance >= 0.001*SATOSHIDEN+coin->txfee ) balance -= coin->txfee - 0.001;
if ( balance > coin->txfee )
{ {
halfval = ((balance - coin->txfee - 0.001) / 100) * 45; halfval = (balance / 100) * 45;
argjson = cJSON_CreateObject(); argjson = cJSON_CreateObject();
outputs = cJSON_CreateArray(); outputs = cJSON_CreateArray();
item = cJSON_CreateObject(); item = cJSON_CreateObject();
@ -1679,7 +1680,7 @@ char *LP_autosplit(struct iguana_info *coin)
jadd(argjson,"outputs",outputs); jadd(argjson,"outputs",outputs);
jaddnum(argjson,"broadcast",1); jaddnum(argjson,"broadcast",1);
jaddstr(argjson,"coin",coin->symbol); jaddstr(argjson,"coin",coin->symbol);
printf("autosplit.(%s)\n",jprint(argjson,0)); //printf("autosplit.(%s)\n",jprint(argjson,0));
retstr = LP_withdraw(coin,argjson); retstr = LP_withdraw(coin,argjson);
free_json(argjson); free_json(argjson);
return(retstr); return(retstr);

7
iguana/exchanges/LP_utxo.c

@ -353,7 +353,7 @@ int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_a
{ {
if ( LP_value_extract(txout,0) == 0 ) if ( LP_value_extract(txout,0) == 0 )
{ {
char str[65]; printf("LP_address_utxo_ptrs skip zero value %s/v%d\n",bits256_str(str,up->U.txid),up->U.vout); //char str[65]; printf("LP_address_utxo_ptrs skip zero value %s/v%d\n",bits256_str(str,up->U.txid),up->U.vout);
free_json(txout); free_json(txout);
up->spendheight = 1; up->spendheight = 1;
if ( (tx= LP_transactionfind(coin,up->U.txid)) != 0 && up->U.vout < tx->numvouts ) if ( (tx= LP_transactionfind(coin,up->U.txid)) != 0 && up->U.vout < tx->numvouts )
@ -364,7 +364,7 @@ char str[65]; printf("LP_address_utxo_ptrs skip zero value %s/v%d\n",bits256_str
} }
else else
{ {
char str[65]; printf("LP_address_utxo_ptrs skips %s %s payment %s/v%d is spent\n",coin->symbol,coinaddr,bits256_str(str,up->U.txid),up->U.vout); //char str[65]; printf("LP_address_utxo_ptrs skips %s %s payment %s/v%d is spent\n",coin->symbol,coinaddr,bits256_str(str,up->U.txid),up->U.vout);
up->spendheight = 1; up->spendheight = 1;
if ( (tx= LP_transactionfind(coin,up->U.txid)) != 0 && up->U.vout < tx->numvouts ) if ( (tx= LP_transactionfind(coin,up->U.txid)) != 0 && up->U.vout < tx->numvouts )
tx->outpoints[up->U.vout].spendheight = 1; tx->outpoints[up->U.vout].spendheight = 1;
@ -386,11 +386,10 @@ char str[65]; printf("LP_address_utxo_ptrs skips %s %s payment %s/v%d is spent\n
utxos[n++] = up; utxos[n++] = up;
if ( n >= max ) if ( n >= max )
break; break;
} else printf("LP_allocated skip %u\n",LP_allocated(up->U.txid,up->U.vout)); } //else printf("LP_allocated skip %u\n",LP_allocated(up->U.txid,up->U.vout));
} }
else else
{ {
printf("avoid case\n");
if ( (tx= LP_transactionfind(coin,up->U.txid)) != 0 && up->U.vout < tx->numvouts ) if ( (tx= LP_transactionfind(coin,up->U.txid)) != 0 && up->U.vout < tx->numvouts )
tx->outpoints[up->U.vout].spendheight = 1; tx->outpoints[up->U.vout].spendheight = 1;
} }

Loading…
Cancel
Save