Browse Source

Test

etomic
jl777 7 years ago
parent
commit
ea81c79c9e
  1. 2
      iguana/exchanges/LP_commands.c
  2. 6
      iguana/exchanges/LP_nativeDEX.c
  3. 14
      iguana/exchanges/LP_utxo.c

2
iguana/exchanges/LP_commands.c

@ -362,7 +362,7 @@ dividends(coin, height, <args>)\n\
coinaddr = jstr(argjson,"coinaddr");
if ( coin != 0 && coinaddr != 0 )
{
//char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",coin,coinaddr,bits256_str(str,txid),vout,dstr(value),height);
char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",coin,coinaddr,bits256_str(str,txid),vout,dstr(value),height);
LP_address_utxoadd(LP_coinfind(coin),coinaddr,txid,vout,value,height,-1);
}
return(clonestr("{\"result\":\"success\"}"));

6
iguana/exchanges/LP_nativeDEX.c

@ -362,15 +362,15 @@ int32_t LP_utxos_sync(struct LP_peerinfo *peer)
}
if ( j == m )
{
//printf("%s missing %s\n",peer->ipaddr,jprint(item,0));
printf("%s missing %s\n",peer->ipaddr,jprint(item,0));
if ( (retstr2= issue_LP_uitem(peer->ipaddr,peer->port,coin->symbol,coin->smartaddr,txid,v,jint(item,"height"),j64bits(item,"value"))) != 0 )
free(retstr2);
posted++;
}
}
if ( 0 && posted != 0 )
if ( 1 && posted != 0 )
printf(">>>>>>>> %s compare %s %s (%.8f n%d) (%.8f m%d)\n",peer->ipaddr,coin->symbol,coin->smartaddr,dstr(total),n,dstr(total2),m);
} //else printf("%s matches\n",peer->ipaddr);
} else printf("%s matches\n",peer->ipaddr);
free_json(array2);
}
free(retstr);

14
iguana/exchanges/LP_utxo.c

@ -189,7 +189,7 @@ struct LP_address_utxo *LP_address_utxofind(struct iguana_info *coin,char *coina
int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout,uint64_t value,int32_t height,int32_t spendheight)
{
struct LP_address *ap; struct LP_address_utxo *up,*tmp; int32_t flag,retval = 0; char str[65];
struct LP_address *ap; cJSON *txobj; struct LP_address_utxo *up,*tmp; int32_t flag,retval = 0; char str[65];
//printf("%s add addr.%s ht.%d\n",coin->symbol,coinaddr,height);
if ( coin == 0 )
return(0);
@ -216,6 +216,16 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid,
}
if ( flag == 0 )
{
if ( coin->electrum == 0 )
{
if ( (txobj= LP_gettxout(coin->symbol,coinaddr,up->U.txid,up->U.vout)) == 0 )
{
if ( up->spendheight <= 0 )
up->spendheight = 1;
printf("prevent utxoadd since gettxout %s/v%d missing\n",bits256_str(str,up->U.txid),up->U.vout);
return(0);
} else free_json(txobj);
}
up = calloc(1,sizeof(*up));
up->U.txid = txid;
up->U.vout = vout;
@ -226,7 +236,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid,
DL_APPEND(ap->utxos,up);
portable_mutex_unlock(&coin->addrmutex);
retval = 1;
if ( 0 && height > 0 )
if ( 1 && height > 0 )
printf("ADDRESS_UTXO >>>>>>>>>> %s %s %s/v%d ht.%d %.8f\n",coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value));
}
} // else printf("cant get ap %s %s\n",coin->symbol,coinaddr);

Loading…
Cancel
Save