mirror of
https://github.com/monero-project/monero.git
synced 2024-12-27 20:49:26 -05:00
tx_pool: add missing blockchain lock in add_tx
This commit is contained in:
parent
8fbbefb8db
commit
31417d57da
@ -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)
|
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);
|
PERF_TIMER(add_tx);
|
||||||
if (tx.version == 0)
|
if (tx.version == 0)
|
||||||
{
|
{
|
||||||
@ -224,6 +227,7 @@ namespace cryptonote
|
|||||||
meta.do_not_relay = do_not_relay;
|
meta.do_not_relay = do_not_relay;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
CRITICAL_REGION_LOCAL1(m_blockchain);
|
||||||
LockedTXN lock(m_blockchain);
|
LockedTXN lock(m_blockchain);
|
||||||
m_blockchain.add_txpool_tx(tx, meta);
|
m_blockchain.add_txpool_tx(tx, meta);
|
||||||
if (!insert_key_images(tx, kept_by_block))
|
if (!insert_key_images(tx, kept_by_block))
|
||||||
@ -260,6 +264,7 @@ namespace cryptonote
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
CRITICAL_REGION_LOCAL1(m_blockchain);
|
||||||
LockedTXN lock(m_blockchain);
|
LockedTXN lock(m_blockchain);
|
||||||
m_blockchain.remove_txpool_tx(get_transaction_hash(tx));
|
m_blockchain.remove_txpool_tx(get_transaction_hash(tx));
|
||||||
m_blockchain.add_txpool_tx(tx, meta);
|
m_blockchain.add_txpool_tx(tx, meta);
|
||||||
|
Loading…
Reference in New Issue
Block a user