blockchain_import: fix wrong reported block/tx hashes on error

This commit is contained in:
moneromooo-monero 2021-03-18 10:18:38 +00:00
parent 0b6bfb1fd8
commit 71741a1ed6
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

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;
} }