mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
blockchain_utilities: simplify getting block blob from height
This commit is contained in:
parent
2287fb9fb4
commit
cb4aafd27e
@ -407,8 +407,7 @@ int main(int argc, char* argv[])
|
|||||||
for (uint64_t h = state.height; h < db_height; ++h)
|
for (uint64_t h = state.height; h < db_height; ++h)
|
||||||
{
|
{
|
||||||
size_t block_ancestry_size = 0;
|
size_t block_ancestry_size = 0;
|
||||||
const crypto::hash block_hash = db->get_block_hash_from_height(h);
|
const cryptonote::blobdata bd = db->get_block_blob_from_height(h);
|
||||||
const cryptonote::blobdata bd = db->get_block_blob(block_hash);
|
|
||||||
++total_blocks;
|
++total_blocks;
|
||||||
cryptonote::block b;
|
cryptonote::block b;
|
||||||
if (!cryptonote::parse_and_validate_block_from_blob(bd, b))
|
if (!cryptonote::parse_and_validate_block_from_blob(bd, b))
|
||||||
@ -482,8 +481,7 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const crypto::hash block_hash = db->get_block_hash_from_height(od.height);
|
cryptonote::blobdata bd = db->get_block_blob_from_height(od.height);
|
||||||
cryptonote::blobdata bd = db->get_block_blob(block_hash);
|
|
||||||
if (!cryptonote::parse_and_validate_block_from_blob(bd, b))
|
if (!cryptonote::parse_and_validate_block_from_blob(bd, b))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Bad block from db");
|
LOG_PRINT_L0("Bad block from db");
|
||||||
@ -620,8 +618,7 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const crypto::hash block_hash = db->get_block_hash_from_height(opt_height);
|
const cryptonote::blobdata bd = db->get_block_blob_from_height(opt_height);
|
||||||
const cryptonote::blobdata bd = db->get_block_blob(block_hash);
|
|
||||||
cryptonote::block b;
|
cryptonote::block b;
|
||||||
if (!cryptonote::parse_and_validate_block_from_blob(bd, b))
|
if (!cryptonote::parse_and_validate_block_from_blob(bd, b))
|
||||||
{
|
{
|
||||||
@ -678,8 +675,7 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
add_ancestor(ancestry, amount, offset);
|
add_ancestor(ancestry, amount, offset);
|
||||||
const output_data_t od = db->get_output_key(amount, offset);
|
const output_data_t od = db->get_output_key(amount, offset);
|
||||||
const crypto::hash block_hash = db->get_block_hash_from_height(od.height);
|
bd = db->get_block_blob_from_height(od.height);
|
||||||
bd = db->get_block_blob(block_hash);
|
|
||||||
cryptonote::block b;
|
cryptonote::block b;
|
||||||
if (!cryptonote::parse_and_validate_block_from_blob(bd, b))
|
if (!cryptonote::parse_and_validate_block_from_blob(bd, b))
|
||||||
{
|
{
|
||||||
|
@ -187,8 +187,7 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const crypto::hash block_hash = db->get_block_hash_from_height(opt_height);
|
const cryptonote::blobdata bd = db->get_block_blob_from_height(opt_height);
|
||||||
const cryptonote::blobdata bd = db->get_block_blob(block_hash);
|
|
||||||
cryptonote::block b;
|
cryptonote::block b;
|
||||||
if (!cryptonote::parse_and_validate_block_from_blob(bd, b))
|
if (!cryptonote::parse_and_validate_block_from_blob(bd, b))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user