1
0
Fork 0
forked from lthn/blockchain

couple tweaks for hf5 transition

This commit is contained in:
cryptozoidberg 2025-03-21 21:38:40 +04:00
parent ead80ac4cb
commit 78293c32d6
No known key found for this signature in database
GPG key ID: 2E10CC61CAC8F36D
2 changed files with 12 additions and 8 deletions

View file

@ -471,6 +471,7 @@ bool blockchain_storage::init(const std::string& config_folder, const boost::pro
LOG_PRINT_L0("In the blockchain hash for the block 3076401 is " << h << " while it is expected to be " << b3076401_id <<
". Most likely recent blocks are alternative and invalid for the current hardfork, thus we truncate the blockchain, so that block 3076400 becomes new top block...");
truncate_blockchain(ZANO_HARDFORK_05_AFTER_HEIGHT + 1);
m_tx_pool.clear();
}
}
else

View file

@ -238,18 +238,21 @@ namespace currency
}
TIME_MEASURE_FINISH_PD(check_inputs_time);
if (tx.version > TRANSACTION_VERSION_PRE_HF4)
if (!from_core)
{
TIME_MEASURE_START_PD(check_post_hf4_balance);
r = check_tx_balance(tx, id);
CHECK_AND_ASSERT_MES_CUSTOM(r, false, { tvc.m_verification_failed = true; }, "post-HF4 tx: balance proof is invalid");
TIME_MEASURE_FINISH_PD(check_post_hf4_balance);
if (tx.version > TRANSACTION_VERSION_PRE_HF4)
{
TIME_MEASURE_START_PD(check_post_hf4_balance);
r = check_tx_balance(tx, id);
CHECK_AND_ASSERT_MES_CUSTOM(r, false, { tvc.m_verification_failed = true; }, "post-HF4 tx: balance proof is invalid");
TIME_MEASURE_FINISH_PD(check_post_hf4_balance);
r = process_type_in_variant_container_and_make_sure_its_unique<asset_descriptor_operation>(tx.extra, [&](const asset_descriptor_operation& ado){
r = process_type_in_variant_container_and_make_sure_its_unique<asset_descriptor_operation>(tx.extra, [&](const asset_descriptor_operation& ado) {
asset_op_verification_context avc = { tx, id, ado };
return m_blockchain.validate_asset_operation(avc, m_blockchain.get_current_blockchain_size());
}, true);
CHECK_AND_ASSERT_MES_CUSTOM(r, false, { tvc.m_verification_failed = true; }, "post-HF4 tx: asset operation is invalid");
}, true);
CHECK_AND_ASSERT_MES_CUSTOM(r, false, { tvc.m_verification_failed = true; }, "post-HF4 tx: asset operation is invalid");
}
}
do_insert_transaction(tx, id, blob_size, kept_by_block, tx_fee, ch_inp_res ? max_used_block_id : null_hash, ch_inp_res ? max_used_block_height : 0);