block BlockchainDB::get_block_from_height(const uint64_t& height) const { blobdata bd = get_block_blob_from_height(height); block b; if (!parse_and_validate_block_from_blob(bd, b)) throw DB_ERROR("Failed to parse block from blob retrieved from the db"); return b; }
block BlockchainDB::get_block(const crypto::hash& h) const { blobdata bd = get_block_blob(h); block b; if (!parse_and_validate_block_from_blob(bd, b)) throw DB_ERROR("Failed to parse block from blob retrieved from the db"); return b; }
//----------------------------------------------------------------------------------------------- bool core::handle_incoming_block_blob(const blobdata& block_blob, block_verification_context& bvc, bool control_miner, bool relay_block) { if (block_blob.size() > m_currency.maxBlockBlobSize()) { LOG_PRINT_L0("WRONG BLOCK BLOB, too big size " << block_blob.size() << ", rejected"); bvc.m_verifivation_failed = true; return false; } Block b = AUTO_VAL_INIT(b); if (!parse_and_validate_block_from_blob(block_blob, b)) { LOG_PRINT_L0("Failed to parse and validate new block"); bvc.m_verifivation_failed = true; return false; } return handle_incoming_block(b, bvc, control_miner, relay_block); }