1
0
Fork 0
forked from lthn/blockchain

fixed gen_block_wrong_version_agains_hardfork

This commit is contained in:
cryptozoidberg 2022-08-22 14:49:49 +02:00
parent 301a460f65
commit bbe8e14e2b
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
4 changed files with 15 additions and 3 deletions

View file

@ -6093,6 +6093,14 @@ bool blockchain_storage::prevalidate_block(const block& bl)
else
return false;
}
//after hard_fork3 and before hard_fork4
else if (m_core_runtime_config.is_hardfork_active_for_height(3, block_height) &&
!m_core_runtime_config.is_hardfork_active_for_height(4, block_height))
{
if (bl.major_version != HF3_BLOCK_MAJOR_VERSION)
return false;
}
//after hard_fork3
if (bl.major_version > CURRENT_BLOCK_MAJOR_VERSION)

View file

@ -1798,7 +1798,7 @@ namespace currency
bool r = false;
for (size_t i = 0; i != sources.size(); i++)
{
const tx_source_entry& source_entry = sources[inputs_mapping[i] + input_starter_index];
const tx_source_entry& source_entry = sources[inputs_mapping[i]];
crypto::hash tx_hash_for_signature = prepare_prefix_hash_for_sign(tx, i + input_starter_index, tx_prefix_hash);
CHECK_AND_ASSERT_MES(tx_hash_for_signature != null_hash, false, "prepare_prefix_hash_for_sign failed");
std::stringstream ss_ring_s;

View file

@ -287,6 +287,10 @@ namespace currency
//---------------------------------------------------------------
bool validate_inputs_sorting(const transaction& tx)
{
if (get_tx_flags(tx) & TX_FLAG_SIGNATURE_MODE_SEPARATE)
return true;
size_t i = 0;
for(; i+1 < tx.vin.size(); i++)
{

View file

@ -693,11 +693,11 @@ bool gen_block_wrong_version_agains_hardfork::c1(currency::core& c, size_t ev_in
r = mine_next_pow_block_in_playtime(mining_accunt.get_public_address(), c, cb); // block with height 4 (won't pass)
CHECK_TEST_CONDITION(!r);
//major lower then norma for hf3 (do we need this half-working backward compability)
//major lower then normal for hf3 (do we need this half-working backward compability? nope, hardfork 3 always put HF3_BLOCK_MAJOR_VERSION in major version )
major_version_to_set = 0;
minor_version_to_set = 0;
r = mine_next_pow_block_in_playtime(mining_accunt.get_public_address(), c, cb); // block with height 4 (won't pass)
CHECK_TEST_CONDITION(r);
CHECK_TEST_CONDITION(!r);
return true;
}