|
|
@ -43,7 +43,16 @@ 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 ) |
|
|
|
portable_mutex_unlock(&LP_utxomutex); |
|
|
|
return(utxo); |
|
|
|
} |
|
|
|
|
|
|
|
struct LP_utxoinfo *LP_utxo2find(bits256 txid,int32_t vout) |
|
|
|
{ |
|
|
|
struct LP_utxoinfo *utxo=0; uint8_t key[sizeof(txid) + sizeof(vout)]; |
|
|
|
memcpy(key,txid.bytes,sizeof(txid)); |
|
|
|
memcpy(&key[sizeof(txid)],&vout,sizeof(vout)); |
|
|
|
portable_mutex_lock(&LP_utxomutex); |
|
|
|
HASH_FIND(hh,LP_utxoinfos2,key,sizeof(key),utxo); |
|
|
|
portable_mutex_unlock(&LP_utxomutex); |
|
|
|
return(utxo); |
|
|
@ -221,6 +230,7 @@ struct LP_utxoinfo *LP_addutxo(int32_t amclient,struct LP_peerinfo *mypeer,int32 |
|
|
|
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); |
|
|
|
if ( LP_utxo2find(txid2,vout2) == 0 ) |
|
|
|
HASH_ADD_KEYPTR(hh,LP_utxoinfos2,utxo->key2,sizeof(utxo->key2),utxo); |
|
|
|
if ( mypeer != 0 ) |
|
|
|
mypeer->numutxos++; |
|
|
|