core: lock incoming tx lock when checking the txpool and chain

This gets rid of an innocuous race trying to add the same tx
twice to the txpool
This commit is contained in:
moneromooo-monero 2018-05-18 09:38:38 +01:00
parent f6dbb967f8
commit f6896d9974
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

View File

@ -676,6 +676,7 @@ namespace cryptonote
bool core::handle_incoming_txs(const std::list<blobdata>& tx_blobs, std::vector<tx_verification_context>& tvc, bool keeped_by_block, bool relayed, bool do_not_relay)
{
TRY_ENTRY();
CRITICAL_REGION_LOCAL(m_incoming_tx_lock);
struct result { bool res; cryptonote::transaction tx; crypto::hash hash; crypto::hash prefix_hash; bool in_txpool; bool in_blockchain; };
std::vector<result> results(tx_blobs.size());