|
|
@ -43,8 +43,17 @@ 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); |
|
|
|
} |
|
|
|
|
|
|
|
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,7 +230,8 @@ 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); |
|
|
|
HASH_ADD_KEYPTR(hh,LP_utxoinfos2,utxo->key2,sizeof(utxo->key2),utxo); |
|
|
|
if ( LP_utxo2find(txid2,vout2) == 0 ) |
|
|
|
HASH_ADD_KEYPTR(hh,LP_utxoinfos2,utxo->key2,sizeof(utxo->key2),utxo); |
|
|
|
if ( mypeer != 0 ) |
|
|
|
mypeer->numutxos++; |
|
|
|
portable_mutex_unlock(&LP_utxomutex); |
|
|
|