From 236ec07294d6e166d835fb737f2f5dfe531780cc Mon Sep 17 00:00:00 2001 From: WeebDataHoarder Date: Thu, 21 Aug 2025 15:03:43 +0200 Subject: [PATCH] WIP: allow adding backdated orphans by fetching transactions from database, not just pool --- src/cryptonote_core/cryptonote_core.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index d96305f3e..6d5167af5 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -1251,15 +1251,30 @@ namespace cryptonote m_miner.resume(); } //----------------------------------------------------------------------------------------------- - block_complete_entry get_block_complete_entry(block& b, tx_memory_pool &pool) + block_complete_entry get_block_complete_entry(block& b, tx_memory_pool &pool, Blockchain &bc) { block_complete_entry bce; bce.block = cryptonote::block_to_blob(b); bce.block_weight = 0; // we can leave it to 0, those txes aren't pruned + for (const auto &tx_hash: b.tx_hashes) { cryptonote::blobdata txblob; - CHECK_AND_ASSERT_THROW_MES(pool.get_transaction(tx_hash, txblob, relay_category::all), "Transaction not found in pool"); + if (!pool.get_transaction(tx_hash, txblob, relay_category::all)) + { + //retry with db storage + + std::vector hashes = {tx_hash}; + std::vector< cryptonote::blobdata> blobs; + std::vector missed; + bc.get_transactions_blobs(hashes, blobs, missed, false); + if (!missed.empty()) + { + ASSERT_MES_AND_THROW("Transaction not found in pool nor database"); + return bce; + } + txblob = blobs[0]; + } bce.txs.push_back({txblob, crypto::null_hash}); } return bce; @@ -1272,7 +1287,7 @@ namespace cryptonote std::vector blocks; try { - blocks.push_back(get_block_complete_entry(b, m_mempool)); + blocks.push_back(get_block_complete_entry(b, m_mempool, m_blockchain_storage)); } catch (const std::exception &e) {