coretests: gen_crypted_attachments and fixed-hash tests

This commit is contained in:
sowle 2024-03-14 22:04:38 +01:00
parent a8bfdc13ed
commit f538fc3a76
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
3 changed files with 21 additions and 3 deletions

View file

@ -708,7 +708,7 @@ bool gen_no_attchments_in_coinbase::init_config_set_cp(currency::core& c, size_t
// different checkpoints due to different block versions for different hardforks -> different hashes
if (crc.is_hardfork_active_for_height(ZANO_HARDFORK_03, 11) && !crc.is_hardfork_active_for_height(ZANO_HARDFORK_04_ZARCANUM, 11))
{
m_checkpoints.add_checkpoint(12, "4e6055dda442e04b2feb70bc7245584742604e8515b8d2e1c3d46c26f758d59f");
m_checkpoints.add_checkpoint(12, "70fbbd33d88ccaa26f9fe64d102bcff2572494009339de9fab7158a40633fbb5");
}
else
{

View file

@ -1638,7 +1638,7 @@ multisig_and_checkpoints::multisig_and_checkpoints()
bool multisig_and_checkpoints::set_cp(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
{
currency::checkpoints checkpoints;
checkpoints.add_checkpoint(15, "6f9194c144afd73077478e7f04e947c50160b5673558e6f696a4f662a3ca261e");
checkpoints.add_checkpoint(15, "fda3e645fbfd0f4852aa68e6ad021c9005c9faf2d7ba6b1b3c8e24efb9c0e8d0");
c.set_checkpoints(std::move(checkpoints));
return true;

View file

@ -939,7 +939,25 @@ bool gen_crypted_attachments::check_crypted_tx(currency::core& c, size_t ev_inde
std::vector<payload_items_v> at;
bool r = currency::decrypt_payload_items(true, *ptx_from_bc, bob_acc.get_keys(), at);
CHECK_EQ(r, true);
CHECK_EQ(at.size(), 8); // custom attachments: 1) tx_payer, 2) tx_comment, 3) std::string; system attachments: 4) tx_crypto_checksum; system extra: 5) tx pub key, 6) extra_attachment_info, 7) etc_tx_flags16_t
if (at.size() != 16)
{
std::stringstream ss;
for(auto& el : at)
ss << " " << el.type().name() << ENDL;
LOG_PRINT_RED("at.size() = " << at.size() << " : " << ENDL << ss.str(), LOG_LEVEL_0);
// expected items:
// public_key
// etc_tx_flags16_t
// tx_derivation_hint x 10
// extra_attachment_info
// tx_payer
// tx_comment
// tx_crypto_checksum
//
// total: 16
CHECK_AND_ASSERT_MES(false, false, "unexpected number of decrypted items");
}
currency::tx_payer decrypted_pr = AUTO_VAL_INIT(decrypted_pr);
r = get_type_in_variant_container(at, decrypted_pr);