cryptonote_basic: some more minor speedups

This commit is contained in:
moneromooo-monero 2018-12-14 00:22:34 +00:00
parent e40eb2ad9d
commit c84ea2993f
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 16 additions and 4 deletions

View File

@ -1090,7 +1090,14 @@ namespace cryptonote
// we still need the size
if (blob_size)
*blob_size = get_object_blobsize(t);
{
if (!t.is_blob_size_valid())
{
t.blob_size = blob.size();
t.set_blob_size_valid(true);
}
*blob_size = t.blob_size;
}
return true;
}
@ -1156,8 +1163,12 @@ namespace cryptonote
if (!hash_result)
return false;
if (get_block_height(b) != 202612)
if (b.miner_tx.vin.size() == 1 && b.miner_tx.vin[0].type() == typeid(cryptonote::txin_gen))
{
const cryptonote::txin_gen &txin_gen = boost::get<cryptonote::txin_gen>(b.miner_tx.vin[0]);
if (txin_gen.height != 202612)
return true;
}
// EXCEPTION FOR BLOCK 202612
const std::string correct_blob_hash_202612 = "3a8a2b3a29b50fc86ff73dd087ea43c6f0d6b8f936c849194d5c84c737903966";
@ -1212,9 +1223,9 @@ namespace cryptonote
bool get_block_longhash(const block& b, crypto::hash& res, uint64_t height)
{
// block 202612 bug workaround
const std::string longhash_202612 = "84f64766475d51837ac9efbef1926486e58563c95a19fef4aec3254f03000000";
if (height == 202612)
{
static const std::string longhash_202612 = "84f64766475d51837ac9efbef1926486e58563c95a19fef4aec3254f03000000";
string_tools::hex_to_pod(longhash_202612, res);
return true;
}
@ -1315,6 +1326,7 @@ namespace cryptonote
crypto::hash get_tx_tree_hash(const block& b)
{
std::vector<crypto::hash> txs_ids;
txs_ids.reserve(1 + b.tx_hashes.size());
crypto::hash h = null_hash;
size_t bl_sz = 0;
get_transaction_hash(b.miner_tx, h, bl_sz);