various fixes for show_transfers, locked_transfer command, blocking of invalid TXs

This commit is contained in:
Some Random Crypto Guy
2024-07-02 21:00:29 +01:00
parent 0663a5ead7
commit 847db19867
11 changed files with 130 additions and 80 deletions
+3 -3
View File
@@ -1044,7 +1044,7 @@ size_t Blockchain::recalculate_difficulties(boost::optional<uint64_t> start_heig
std::vector<difficulty_type> new_cumulative_difficulties;
for (uint64_t height = start_height; height <= top_height; ++height)
{
size_t target = get_ideal_hard_fork_version(height) < 2 ? DIFFICULTY_TARGET_V1 : DIFFICULTY_TARGET_V2;
size_t target = DIFFICULTY_TARGET_V2;
difficulty_type recalculated_diff = next_difficulty(timestamps, difficulties, target);
boost::multiprecision::uint256_t recalculated_cum_diff_256 = boost::multiprecision::uint256_t(recalculated_diff) + last_cum_diff;
@@ -1351,7 +1351,7 @@ difficulty_type Blockchain::get_next_difficulty_for_alternative_chain(const std:
}
// FIXME: This will fail if fork activation heights are subject to voting
size_t target = get_ideal_hard_fork_version(bei.height) < 2 ? DIFFICULTY_TARGET_V1 : DIFFICULTY_TARGET_V2;
size_t target = DIFFICULTY_TARGET_V2;
// calculate the difficulty target for the block and return it
return next_difficulty(timestamps, cumulative_difficulties, target);
@@ -5978,7 +5978,7 @@ bool Blockchain::get_hard_fork_voting_info(uint8_t version, uint32_t &window, ui
uint64_t Blockchain::get_difficulty_target() const
{
return get_current_hard_fork_version() < 2 ? DIFFICULTY_TARGET_V1 : DIFFICULTY_TARGET_V2;
return DIFFICULTY_TARGET_V2;
}
std::map<uint64_t, std::tuple<uint64_t, uint64_t, uint64_t>> Blockchain:: get_output_histogram(const std::vector<uint64_t> &amounts, bool unlocked, uint64_t recent_cutoff, uint64_t min_count) const
+7
View File
@@ -260,6 +260,13 @@ namespace cryptonote
return false;
}
// Check the TX type
if (tx.type <= cryptonote::transaction_type::UNSET || tx.type > cryptonote::transaction_type::MAX) {
LOG_PRINT_L1("Transaction with id= "<< id << " has invalid type " << (uint8_t)tx.type);
tvc.m_verifivation_failed = true;
return false;
}
// assume failure during verification steps until success is certain
tvc.m_verifivation_failed = true;