diff options
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 11 | ||||
-rw-r--r-- | src/cryptonote_core/cryptonote_format_utils.h | 33 | ||||
-rw-r--r-- | src/cryptonote_core/tx_pool.cpp | 2 |
3 files changed, 30 insertions, 16 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 0fad742f9..5f9d6937b 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -525,6 +525,7 @@ bool Blockchain::reset_and_set_genesis_block(const block& b) { LOG_PRINT_L3("Blockchain::" << __func__); CRITICAL_REGION_LOCAL(m_blockchain_lock); + m_timestamps_and_difficulties_height = 0; m_alternative_chains.clear(); m_db->reset(); m_hardfork->init(); @@ -1895,11 +1896,11 @@ bool Blockchain::get_transactions(const t_ids_container& txs_ids, t_tx_container { try { - txs.push_back(m_db->get_tx(tx_hash)); - } - catch (const TX_DNE& e) - { - missed_txs.push_back(tx_hash); + transaction tx; + if (m_db->get_tx(tx_hash, tx)) + txs.push_back(std::move(tx)); + else + missed_txs.push_back(tx_hash); } catch (const std::exception& e) { diff --git a/src/cryptonote_core/cryptonote_format_utils.h b/src/cryptonote_core/cryptonote_format_utils.h index 704b8467d..a6610e60d 100644 --- a/src/cryptonote_core/cryptonote_format_utils.h +++ b/src/cryptonote_core/cryptonote_format_utils.h @@ -36,7 +36,8 @@ #include "crypto/crypto.h" #include "crypto/hash.h" #include "ringct/rctOps.h" - +#include <boost/serialization/vector.hpp> +#include <boost/serialization/utility.hpp> namespace cryptonote { @@ -62,16 +63,6 @@ namespace cryptonote rct::key mask; //ringct amount mask void push_output(uint64_t idx, const crypto::public_key &k, uint64_t amount) { outputs.push_back(std::make_pair(idx, rct::ctkey({rct::pk2rct(k), rct::zeroCommit(amount)}))); } - - BEGIN_SERIALIZE_OBJECT() - FIELD(outputs) - VARINT_FIELD(real_output) - FIELD(real_out_tx_key) - VARINT_FIELD(real_output_in_tx_index) - VARINT_FIELD(amount) - FIELD(rct) - FIELD(mask) - END_SERIALIZE() }; struct tx_destination_entry @@ -261,3 +252,23 @@ namespace cryptonote specific_type& variable_name = boost::get<specific_type>(variant_var); } + +BOOST_CLASS_VERSION(cryptonote::tx_source_entry, 0) + +namespace boost +{ + namespace serialization + { + template <class Archive> + inline void serialize(Archive &a, cryptonote::tx_source_entry &x, const boost::serialization::version_type ver) + { + a & x.outputs; + a & x.real_output; + a & x.real_out_tx_key; + a & x.real_output_in_tx_index; + a & x.amount; + a & x.rct; + a & x.mask; + } + } +} diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index 4d9cdbb8d..59ac534fe 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -195,6 +195,8 @@ namespace cryptonote txd_p.first->second.fee = fee; txd_p.first->second.max_used_block_id = null_hash; txd_p.first->second.max_used_block_height = 0; + txd_p.first->second.last_failed_height = 0; + txd_p.first->second.last_failed_id = null_hash; txd_p.first->second.kept_by_block = kept_by_block; txd_p.first->second.receive_time = time(nullptr); txd_p.first->second.last_relayed_time = time(NULL); |