Merge pull request #7611

71741a1 blockchain_import: fix wrong reported block/tx hashes on error (moneromooo-monero)
This commit is contained in:
luigi1111 2021-06-24 13:59:12 -05:00
commit 1796b44c67
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010

View File

@ -146,7 +146,7 @@ int check_flush(cryptonote::core &core, std::vector<block_complete_entry> &block
if (!parse_and_validate_block_from_blob(b.block, block)) if (!parse_and_validate_block_from_blob(b.block, block))
{ {
MERROR("Failed to parse block: " MERROR("Failed to parse block: "
<< epee::string_tools::pod_to_hex(get_blob_hash(b.block))); << epee::string_tools::buff_to_hex_nodelimer(b.block));
core.cleanup_handle_incoming_blocks(); core.cleanup_handle_incoming_blocks();
return 1; return 1;
} }
@ -177,8 +177,11 @@ int check_flush(cryptonote::core &core, std::vector<block_complete_entry> &block
core.handle_incoming_tx(tx_blob, tvc, relay_method::block, true); core.handle_incoming_tx(tx_blob, tvc, relay_method::block, true);
if(tvc.m_verifivation_failed) if(tvc.m_verifivation_failed)
{ {
MERROR("transaction verification failed, tx_id = " cryptonote::transaction transaction;
<< epee::string_tools::pod_to_hex(get_blob_hash(tx_blob.blob))); if (cryptonote::parse_and_validate_tx_from_blob(tx_blob.blob, transaction))
MERROR("Transaction verification failed, tx_id = " << cryptonote::get_transaction_hash(transaction));
else
MERROR("Transaction verification failed, transaction is unparsable");
core.cleanup_handle_incoming_blocks(); core.cleanup_handle_incoming_blocks();
return 1; return 1;
} }
@ -192,8 +195,11 @@ int check_flush(cryptonote::core &core, std::vector<block_complete_entry> &block
if(bvc.m_verifivation_failed) if(bvc.m_verifivation_failed)
{ {
MERROR("Block verification failed, id = " cryptonote::block block;
<< epee::string_tools::pod_to_hex(get_blob_hash(block_entry.block))); if (cryptonote::parse_and_validate_block_from_blob(block_entry.block, block))
MERROR("Block verification failed, id = " << cryptonote::get_block_hash(block));
else
MERROR("Block verification failed, block is unparsable");
core.cleanup_handle_incoming_blocks(); core.cleanup_handle_incoming_blocks();
return 1; return 1;
} }