mirror of
https://github.com/monero-project/monero.git
synced 2024-12-14 20:36:31 +02:00
Build fixes for the old blockchain_storage version
This commit is contained in:
parent
7003e7c156
commit
3e89df4150
@ -162,7 +162,9 @@ int main(int argc, char* argv[])
|
|||||||
LOG_PRINT_L0("Setting log level = " << log_level);
|
LOG_PRINT_L0("Setting log level = " << log_level);
|
||||||
|
|
||||||
bool opt_testnet = command_line::get_arg(vm, arg_testnet_on);
|
bool opt_testnet = command_line::get_arg(vm, arg_testnet_on);
|
||||||
|
#if SOURCE_DB != DB_MEMORY
|
||||||
bool opt_include_db_only_data = command_line::get_arg(vm, arg_include_db_only_data);
|
bool opt_include_db_only_data = command_line::get_arg(vm, arg_include_db_only_data);
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string m_config_folder;
|
std::string m_config_folder;
|
||||||
|
|
||||||
@ -271,7 +273,6 @@ int main(int argc, char* argv[])
|
|||||||
start_struct(d,"blockchain");
|
start_struct(d,"blockchain");
|
||||||
uint64_t height = core_storage->get_current_blockchain_height();
|
uint64_t height = core_storage->get_current_blockchain_height();
|
||||||
write_pod(d, "height", height);
|
write_pod(d, "height", height);
|
||||||
goto start;
|
|
||||||
start_array(d,"blockids", true);
|
start_array(d,"blockids", true);
|
||||||
for (uint64_t h = 0; h < height; ++h)
|
for (uint64_t h = 0; h < height; ++h)
|
||||||
write_pod(d,core_storage->get_block_id_by_height(h));
|
write_pod(d,core_storage->get_block_id_by_height(h));
|
||||||
@ -310,6 +311,7 @@ goto start;
|
|||||||
end_compound(d);
|
end_compound(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
end_compound(d);
|
||||||
start_struct(d,"blocks", true);
|
start_struct(d,"blocks", true);
|
||||||
{
|
{
|
||||||
std::vector<crypto::hash> blockids;
|
std::vector<crypto::hash> blockids;
|
||||||
@ -333,6 +335,7 @@ goto start;
|
|||||||
write_pod(d,key_images[n]);
|
write_pod(d,key_images[n]);
|
||||||
}
|
}
|
||||||
end_compound(d);
|
end_compound(d);
|
||||||
|
#if SOURCE_DB != DB_MEMORY
|
||||||
if (opt_include_db_only_data)
|
if (opt_include_db_only_data)
|
||||||
{
|
{
|
||||||
start_struct(d, "block_timestamps", true);
|
start_struct(d, "block_timestamps", true);
|
||||||
@ -386,7 +389,6 @@ goto start;
|
|||||||
catch (const OUTPUT_DNE &) { break; }
|
catch (const OUTPUT_DNE &) { break; }
|
||||||
}
|
}
|
||||||
end_compound(d);
|
end_compound(d);
|
||||||
start:
|
|
||||||
start_struct(d, "outputs_amounts", true);
|
start_struct(d, "outputs_amounts", true);
|
||||||
for (uint64_t base = 1; base <= (uint64_t)10000000000000000000ul; base *= 10) for (uint64_t digit = 1; digit <= 9; ++digit) {
|
for (uint64_t base = 1; base <= (uint64_t)10000000000000000000ul; base *= 10) for (uint64_t digit = 1; digit <= 9; ++digit) {
|
||||||
uint64_t amount = digit * base;
|
uint64_t amount = digit * base;
|
||||||
@ -417,6 +419,7 @@ start:
|
|||||||
write_pod(d, boost::lexical_cast<std::string>(v), db->get_hard_fork_starting_height(v));
|
write_pod(d, boost::lexical_cast<std::string>(v), db->get_hard_fork_starting_height(v));
|
||||||
end_compound(d);
|
end_compound(d);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
end_compound(d);
|
end_compound(d);
|
||||||
|
|
||||||
CHECK_AND_ASSERT_MES(r, false, "Failed to dump blockchain");
|
CHECK_AND_ASSERT_MES(r, false, "Failed to dump blockchain");
|
||||||
|
@ -1900,19 +1900,21 @@ bool blockchain_storage::for_all_key_images(std::function<bool(const crypto::key
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
bool blockchain_storage::for_all_blocks(std::function<bool(uint64_t, const block&)> f) const
|
bool blockchain_storage::for_all_blocks(std::function<bool(uint64_t, const crypto::hash&, const block&)> f) const
|
||||||
{
|
{
|
||||||
for (blocks_container::const_iterator i = m_blocks.begin(); i != m_blocks.end(); ++i) {
|
for (blocks_container::const_iterator i = m_blocks.begin(); i != m_blocks.end(); ++i) {
|
||||||
if (!f(i->height, i->bl))
|
crypto::hash hash;
|
||||||
|
get_block_hash (i->bl, hash);
|
||||||
|
if (!f(i->height, hash, i->bl))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
bool blockchain_storage::for_all_transactions(std::function<bool(const transaction&)> f) const
|
bool blockchain_storage::for_all_transactions(std::function<bool(const crypto::hash&, const transaction&)> f) const
|
||||||
{
|
{
|
||||||
for (transactions_container::const_iterator i = m_transactions.begin(); i != m_transactions.end(); ++i) {
|
for (transactions_container::const_iterator i = m_transactions.begin(); i != m_transactions.end(); ++i) {
|
||||||
if (!f(i->second.tx))
|
if (!f(i->first, i->second.tx))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -186,8 +186,8 @@ namespace cryptonote
|
|||||||
uint64_t get_block_coins_generated(uint64_t height) const { return m_blocks[height].already_generated_coins; }
|
uint64_t get_block_coins_generated(uint64_t height) const { return m_blocks[height].already_generated_coins; }
|
||||||
|
|
||||||
bool for_all_key_images(std::function<bool(const crypto::key_image&)>) const;
|
bool for_all_key_images(std::function<bool(const crypto::key_image&)>) const;
|
||||||
bool for_all_blocks(std::function<bool(uint64_t height, const block&)>) const;
|
bool for_all_blocks(std::function<bool(uint64_t height, const crypto::hash&, const block&)>) const;
|
||||||
bool for_all_transactions(std::function<bool(const transaction&)>) const;
|
bool for_all_transactions(std::function<bool(const crypto::hash&, const transaction&)>) const;
|
||||||
bool for_all_outputs(std::function<bool(uint64_t amount, const crypto::hash &tx_hash, size_t tx_idx)>) const;
|
bool for_all_outputs(std::function<bool(uint64_t amount, const crypto::hash &tx_hash, size_t tx_idx)>) const;
|
||||||
|
|
||||||
// use for testing only
|
// use for testing only
|
||||||
|
@ -98,6 +98,11 @@ public:
|
|||||||
virtual void add_spent_key(const crypto::key_image& k_image) {}
|
virtual void add_spent_key(const crypto::key_image& k_image) {}
|
||||||
virtual void remove_spent_key(const crypto::key_image& k_image) {}
|
virtual void remove_spent_key(const crypto::key_image& k_image) {}
|
||||||
|
|
||||||
|
virtual bool for_all_key_images(std::function<bool(const crypto::key_image&)>) const { return true; }
|
||||||
|
virtual bool for_all_blocks(std::function<bool(uint64_t, const crypto::hash&, const cryptonote::block&)>) const { return true; }
|
||||||
|
virtual bool for_all_transactions(std::function<bool(const crypto::hash&, const cryptonote::transaction&)>) const { return true; }
|
||||||
|
virtual bool for_all_outputs(std::function<bool(uint64_t amount, const crypto::hash &tx_hash, size_t tx_idx)> f) const { return true; }
|
||||||
|
|
||||||
virtual void add_block( const block& blk
|
virtual void add_block( const block& blk
|
||||||
, const size_t& block_size
|
, const size_t& block_size
|
||||||
, const difficulty_type& cumulative_difficulty
|
, const difficulty_type& cumulative_difficulty
|
||||||
|
Loading…
Reference in New Issue
Block a user