Merge pull request #4920

e98ae34e core: fix adding new pre-hoh block when a tx is already in the pool (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-12-12 11:59:43 +02:00
commit e19a205ff4
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
1 changed files with 4 additions and 5 deletions

View File

@ -901,13 +901,15 @@ namespace cryptonote
bool ok = true; bool ok = true;
it = tx_blobs.begin(); it = tx_blobs.begin();
for (size_t i = 0; i < tx_blobs.size(); i++, ++it) { for (size_t i = 0; i < tx_blobs.size(); i++, ++it) {
if (already_have[i])
continue;
if (!results[i].res) if (!results[i].res)
{ {
ok = false; ok = false;
continue; continue;
} }
if (keeped_by_block)
get_blockchain_storage().on_new_tx_from_block(results[i].tx);
if (already_have[i])
continue;
const size_t weight = get_transaction_weight(results[i].tx, it->size()); const size_t weight = get_transaction_weight(results[i].tx, it->size());
ok &= add_new_tx(results[i].tx, results[i].hash, tx_blobs[i], results[i].prefix_hash, weight, tvc[i], keeped_by_block, relayed, do_not_relay); ok &= add_new_tx(results[i].tx, results[i].hash, tx_blobs[i], results[i].prefix_hash, weight, tvc[i], keeped_by_block, relayed, do_not_relay);
@ -1138,9 +1140,6 @@ namespace cryptonote
//----------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------
bool core::add_new_tx(transaction& tx, const crypto::hash& tx_hash, const cryptonote::blobdata &blob, const crypto::hash& tx_prefix_hash, size_t tx_weight, tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay) bool core::add_new_tx(transaction& tx, const crypto::hash& tx_hash, const cryptonote::blobdata &blob, const crypto::hash& tx_prefix_hash, size_t tx_weight, tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay)
{ {
if (keeped_by_block)
get_blockchain_storage().on_new_tx_from_block(tx);
if(m_mempool.have_tx(tx_hash)) if(m_mempool.have_tx(tx_hash))
{ {
LOG_PRINT_L2("tx " << tx_hash << "already have transaction in tx_pool"); LOG_PRINT_L2("tx " << tx_hash << "already have transaction in tx_pool");