|
@ -348,7 +348,15 @@ struct LP_utxos_qitem { struct queueitem DL; cJSON *argjson; }; |
|
|
|
|
|
|
|
|
char *LP_postutxos_recv(cJSON *argjson) |
|
|
char *LP_postutxos_recv(cJSON *argjson) |
|
|
{ |
|
|
{ |
|
|
struct LP_utxos_qitem *uitem; bits256 utxoshash; cJSON *obj; |
|
|
struct LP_utxos_qitem *uitem; struct iguana_info *coin; char *coinaddr,*symbol; bits256 utxoshash; cJSON *obj; |
|
|
|
|
|
if ( (coinaddr= jstr(argjson,"coinaddr")) != 0 && (symbol= jstr(argjson,"coin")) != 0 && (coin= LP_coinfind(symbol)) != 0 ) |
|
|
|
|
|
{ |
|
|
|
|
|
if ( strcmp(coinaddr,coin->smartaddr) == 0 ) |
|
|
|
|
|
{ |
|
|
|
|
|
printf("ignore my utxo from external source %s %s\n",symbol,coinaddr); |
|
|
|
|
|
return(clonestr("{\"result\":\"success\"}")); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
if ( (obj= jobj(argjson,"utxos")) != 0 ) |
|
|
if ( (obj= jobj(argjson,"utxos")) != 0 ) |
|
|
{ |
|
|
{ |
|
|
utxoshash = LP_utxoshash_calc(obj); |
|
|
utxoshash = LP_utxoshash_calc(obj); |
|
@ -602,16 +610,18 @@ void LP_smartutxos_push(struct iguana_info *coin) |
|
|
|
|
|
|
|
|
char *LP_uitem_recv(cJSON *argjson) |
|
|
char *LP_uitem_recv(cJSON *argjson) |
|
|
{ |
|
|
{ |
|
|
bits256 txid; int32_t vout,height; uint64_t value; char *coinaddr,*symbol; |
|
|
bits256 txid; int32_t vout,height; uint64_t value; struct iguana_info *coin; char *coinaddr,*symbol; |
|
|
txid = jbits256(argjson,"txid"); |
|
|
txid = jbits256(argjson,"txid"); |
|
|
vout = jint(argjson,"vout"); |
|
|
vout = jint(argjson,"vout"); |
|
|
height = jint(argjson,"ht"); |
|
|
height = jint(argjson,"ht"); |
|
|
value = j64bits(argjson,"value"); |
|
|
value = j64bits(argjson,"value"); |
|
|
coinaddr = jstr(argjson,"coinaddr"); |
|
|
coinaddr = jstr(argjson,"coinaddr"); |
|
|
if ( (symbol= jstr(argjson,"coin")) != 0 && coinaddr != 0 ) |
|
|
if ( (symbol= jstr(argjson,"coin")) != 0 && coinaddr != 0 && (coin= LP_coinfind(symbol)) != 0 ) |
|
|
{ |
|
|
{ |
|
|
//char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",symbol,coinaddr,bits256_str(str,txid),vout,dstr(value),height);
|
|
|
//char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",symbol,coinaddr,bits256_str(str,txid),vout,dstr(value),height);
|
|
|
LP_address_utxoadd("LP_uitem,recv",LP_coinfind(symbol),coinaddr,txid,vout,value,height,-1); |
|
|
if ( strcmp(coin->smartaddr,coinaddr) != 0 ) |
|
|
|
|
|
LP_address_utxoadd("LP_uitem,recv",coin,coinaddr,txid,vout,value,height,-1); |
|
|
|
|
|
else printf("ignore external uitem %s %s\n",symbol,coin->smartaddr); |
|
|
} |
|
|
} |
|
|
return(clonestr("{\"result\":\"success\"}")); |
|
|
return(clonestr("{\"result\":\"success\"}")); |
|
|
} |
|
|
} |
|
|