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.
This commit is contained in:
moneromooo-monero 2017-05-14 14:06:55 +01:00
parent 9ed496bbc5
commit b52abd1370
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
17 changed files with 847 additions and 289 deletions

View file

@ -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);