|
|
@ -43,6 +43,8 @@ struct LP_utxoinfo *LP_utxofind(bits256 txid,int32_t vout) |
|
|
|
memcpy(&key[sizeof(txid)],&vout,sizeof(vout)); |
|
|
|
portable_mutex_lock(&LP_utxomutex); |
|
|
|
HASH_FIND(hh,LP_utxoinfos,key,sizeof(key),utxo); |
|
|
|
if ( utxo == 0 ) |
|
|
|
HASH_FIND(hh,LP_utxoinfos2,key,sizeof(key),utxo); |
|
|
|
portable_mutex_unlock(&LP_utxomutex); |
|
|
|
return(utxo); |
|
|
|
} |
|
|
@ -107,6 +109,8 @@ void LP_spentnotify(struct LP_utxoinfo *utxo,int32_t selector) |
|
|
|
{ |
|
|
|
cJSON *argjson; |
|
|
|
utxo->spentflag = (uint32_t)time(NULL); |
|
|
|
if ( LP_mypeer != 0 && LP_mypeer->numutxos > 0 ) |
|
|
|
LP_mypeer->numutxos--; |
|
|
|
if ( LP_mypubsock >= 0 ) |
|
|
|
{ |
|
|
|
argjson = cJSON_CreateObject(); |
|
|
@ -211,8 +215,11 @@ struct LP_utxoinfo *LP_addutxo(int32_t amclient,struct LP_peerinfo *mypeer,int32 |
|
|
|
utxo->value2 = value2; |
|
|
|
memcpy(utxo->key,txid.bytes,sizeof(txid)); |
|
|
|
memcpy(&utxo->key[sizeof(txid)],&vout,sizeof(vout)); |
|
|
|
memcpy(utxo->key2,txid2.bytes,sizeof(txid2)); |
|
|
|
memcpy(&utxo->key2[sizeof(txid2)],&vout2,sizeof(vout2)); |
|
|
|
portable_mutex_lock(&LP_utxomutex); |
|
|
|
HASH_ADD_KEYPTR(hh,LP_utxoinfos,utxo->key,sizeof(utxo->key),utxo); |
|
|
|
HASH_ADD_KEYPTR(hh,LP_utxoinfos2,utxo->key2,sizeof(utxo->key2),utxo); |
|
|
|
if ( mypeer != 0 ) |
|
|
|
mypeer->numutxos++; |
|
|
|
portable_mutex_unlock(&LP_utxomutex); |
|
|
|