diff options
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 19 | ||||
-rw-r--r-- | src/cryptonote_core/blockchain.h | 2 | ||||
-rw-r--r-- | src/cryptonote_core/blockchain_storage.cpp | 19 | ||||
-rw-r--r-- | src/cryptonote_core/blockchain_storage.h | 1 | ||||
-rw-r--r-- | src/cryptonote_core/tx_pool.h | 5 |
5 files changed, 45 insertions, 1 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 4b7add9eb..3702908e7 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -2385,6 +2385,25 @@ void Blockchain::return_tx_to_pool(const std::vector<transaction> &txs) } } //------------------------------------------------------------------ +bool Blockchain::flush_txes_from_pool(const std::list<crypto::hash> &txids) +{ + bool res = true; + for (const auto &txid: txids) + { + cryptonote::transaction tx; + size_t blob_size; + uint64_t fee; + bool relayed; + LOG_PRINT_L1("Removing txid " << txid << " from the pool"); + if(!m_tx_pool.take_tx(txid, tx, blob_size, fee, relayed)) + { + LOG_PRINT_L0("Failed to remove txid " << txid << " from the pool"); + res = false; + } + } + return res; +} +//------------------------------------------------------------------ // Needs to validate the block and acquire each transaction from the // transaction mem_pool, then pass the block and transactions to // m_db->add_block() diff --git a/src/cryptonote_core/blockchain.h b/src/cryptonote_core/blockchain.h index 87c8a2454..ecabf5376 100644 --- a/src/cryptonote_core/blockchain.h +++ b/src/cryptonote_core/blockchain.h @@ -164,6 +164,8 @@ namespace cryptonote bool get_hard_fork_voting_info(uint8_t version, uint32_t &window, uint32_t &votes, uint32_t &threshold, uint64_t &earliest_height, uint8_t &voting) const; + bool flush_txes_from_pool(const std::list<crypto::hash> &txids); + bool for_all_key_images(std::function<bool(const crypto::key_image&)>) const; bool for_all_blocks(std::function<bool(uint64_t, const crypto::hash&, const block&)>) const; bool for_all_transactions(std::function<bool(const crypto::hash&, const cryptonote::transaction&)>) const; diff --git a/src/cryptonote_core/blockchain_storage.cpp b/src/cryptonote_core/blockchain_storage.cpp index f656f938b..e1b89f887 100644 --- a/src/cryptonote_core/blockchain_storage.cpp +++ b/src/cryptonote_core/blockchain_storage.cpp @@ -1892,6 +1892,25 @@ void blockchain_storage::set_enforce_dns_checkpoints(bool enforce_checkpoints) m_enforce_dns_checkpoints = enforce_checkpoints; } //------------------------------------------------------------------ +bool blockchain_storage::flush_txes_from_pool(const std::list<crypto::hash> &txids) +{ + bool res = true; + for (const auto &txid: txids) + { + cryptonote::transaction tx; + size_t blob_size; + uint64_t fee; + bool relayed; + LOG_PRINT_L1("Removing txid " << txid << " from the pool"); + if(!m_tx_pool->take_tx(txid, tx, blob_size, fee, relayed)) + { + LOG_PRINT_L0("Failed to remove txid " << txid << " from the pool"); + res = false; + } + } + return res; +} +//------------------------------------------------------------------ bool blockchain_storage::for_all_key_images(std::function<bool(const crypto::key_image&)> f) const { for (key_images_container::const_iterator i = m_spent_keys.begin(); i != m_spent_keys.end(); ++i) { diff --git a/src/cryptonote_core/blockchain_storage.h b/src/cryptonote_core/blockchain_storage.h index cb5e17cdb..878202cf1 100644 --- a/src/cryptonote_core/blockchain_storage.h +++ b/src/cryptonote_core/blockchain_storage.h @@ -130,6 +130,7 @@ namespace cryptonote bool is_storing_blockchain()const{return m_is_blockchain_storing;} uint64_t block_difficulty(size_t i) const; double get_avg_block_size( size_t count) const; + bool flush_txes_from_pool(const std::list<crypto::hash> &txids); template<class t_ids_container, class t_blocks_container, class t_missed_container> bool get_blocks(const t_ids_container& block_ids, t_blocks_container& blocks, t_missed_container& missed_bs) const diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h index 9667e6159..71febcab6 100644 --- a/src/cryptonote_core/tx_pool.h +++ b/src/cryptonote_core/tx_pool.h @@ -110,7 +110,7 @@ namespace cryptonote /*bool flush_pool(const std::strig& folder); bool inflate_pool(const std::strig& folder);*/ -#define CURRENT_MEMPOOL_ARCHIVE_VER 10 +#define CURRENT_MEMPOOL_ARCHIVE_VER 11 template<class archive_t> void serialize(archive_t & a, const unsigned int version) @@ -241,6 +241,9 @@ namespace boost ar & td.receive_time; ar & td.last_relayed_time; ar & td.relayed; + if (version < 11) + return; + ar & td.kept_by_block; } } } |