From b52abd1370cc21484d64f45504adbab47240debf Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 14 May 2017 14:06:55 +0100 Subject: Move txpool to the database Integration could go further (ie, return_tx_to_pool calls should not be needed anymore, possibly other things). poolstate.bin is now obsolete. --- src/cryptonote_protocol/cryptonote_protocol_handler.inl | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/cryptonote_protocol') diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index 79578a34e..8b41ce514 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -479,7 +479,7 @@ namespace cryptonote // we might already have the tx that the peer // sent in our pool, so don't verify again.. - if(!m_core.get_pool_transaction(tx_hash, tx)) + if(!m_core.pool_has_tx(tx_hash)) { MDEBUG("Incoming tx " << tx_hash << " not in pool, adding"); cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc); @@ -536,9 +536,10 @@ namespace cryptonote size_t tx_idx = 0; for(auto& tx_hash: new_block.tx_hashes) { - if(m_core.get_pool_transaction(tx_hash, tx)) + cryptonote::blobdata txblob; + if(m_core.get_pool_transaction(tx_hash, txblob)) { - have_tx.push_back(tx_to_blob(tx)); + have_tx.push_back(txblob); } else { @@ -731,6 +732,15 @@ namespace cryptonote if(context.m_state != cryptonote_connection_context::state_normal) return 1; + // while syncing, core will lock for a long time, so we ignore + // those txes as they aren't really needed anyway, and avoid a + // long block before replying + if(!is_synchronized()) + { + LOG_DEBUG_CC(context, "Received new tx while syncing, ignored"); + return 1; + } + for(auto tx_blob_it = arg.txs.begin(); tx_blob_it!=arg.txs.end();) { cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc); -- cgit v1.2.3