aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-06-01 19:33:17 +0200
committerRiccardo Spagni <ric@spagni.net>2017-06-01 19:33:17 +0200
commit4a60e9e66ec0d5318b1edfc539b17e0f15a47a81 (patch)
treefee443bae93953354be22db0feacc58ce91d6541 /src
parentMerge pull request #2061 (diff)
parenttx_pool: add missing blockchain lock in add_tx (diff)
downloadmonero-4a60e9e66ec0d5318b1edfc539b17e0f15a47a81.tar.xz
Merge pull request #2062
31417d57 tx_pool: add missing blockchain lock in add_tx (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r--src/cryptonote_core/tx_pool.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp
index ebf170c8c..515918cfa 100644
--- a/src/cryptonote_core/tx_pool.cpp
+++ b/src/cryptonote_core/tx_pool.cpp
@@ -107,6 +107,9 @@ namespace cryptonote
//---------------------------------------------------------------------------------
bool tx_memory_pool::add_tx(transaction &tx, /*const crypto::hash& tx_prefix_hash,*/ const crypto::hash &id, size_t blob_size, tx_verification_context& tvc, bool kept_by_block, bool relayed, bool do_not_relay, uint8_t version)
{
+ // this should already be called with that lock, but let's make it explicit for clarity
+ CRITICAL_REGION_LOCAL(m_transactions_lock);
+
PERF_TIMER(add_tx);
if (tx.version == 0)
{
@@ -224,6 +227,7 @@ namespace cryptonote
meta.do_not_relay = do_not_relay;
try
{
+ CRITICAL_REGION_LOCAL1(m_blockchain);
LockedTXN lock(m_blockchain);
m_blockchain.add_txpool_tx(tx, meta);
if (!insert_key_images(tx, kept_by_block))
@@ -260,6 +264,7 @@ namespace cryptonote
try
{
+ CRITICAL_REGION_LOCAL1(m_blockchain);
LockedTXN lock(m_blockchain);
m_blockchain.remove_txpool_tx(get_transaction_hash(tx));
m_blockchain.add_txpool_tx(tx, meta);