cryptonote: throw on tx hash calculation error
This commit is contained in:
parent
db2b9fba65
commit
f215219252
|
@ -221,8 +221,7 @@ namespace cryptonote
|
||||||
tx.invalidate_hashes();
|
tx.invalidate_hashes();
|
||||||
//TODO: validate tx
|
//TODO: validate tx
|
||||||
|
|
||||||
get_transaction_hash(tx, tx_hash);
|
return get_transaction_hash(tx, tx_hash);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
bool parse_and_validate_tx_from_blob(const blobdata& tx_blob, transaction& tx, crypto::hash& tx_hash, crypto::hash& tx_prefix_hash)
|
bool parse_and_validate_tx_from_blob(const blobdata& tx_blob, transaction& tx, crypto::hash& tx_hash, crypto::hash& tx_prefix_hash)
|
||||||
|
@ -975,6 +974,7 @@ namespace cryptonote
|
||||||
{
|
{
|
||||||
crypto::hash h = null_hash;
|
crypto::hash h = null_hash;
|
||||||
get_transaction_hash(t, h, NULL);
|
get_transaction_hash(t, h, NULL);
|
||||||
|
CHECK_AND_ASSERT_THROW_MES(get_transaction_hash(t, h, NULL), "Failed to calculate transaction hash");
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
|
@ -1327,7 +1327,7 @@ namespace cryptonote
|
||||||
txs_ids.reserve(1 + b.tx_hashes.size());
|
txs_ids.reserve(1 + b.tx_hashes.size());
|
||||||
crypto::hash h = null_hash;
|
crypto::hash h = null_hash;
|
||||||
size_t bl_sz = 0;
|
size_t bl_sz = 0;
|
||||||
get_transaction_hash(b.miner_tx, h, bl_sz);
|
CHECK_AND_ASSERT_THROW_MES(get_transaction_hash(b.miner_tx, h, bl_sz), "Failed to calculate transaction hash");
|
||||||
txs_ids.push_back(h);
|
txs_ids.push_back(h);
|
||||||
for(auto& th: b.tx_hashes)
|
for(auto& th: b.tx_hashes)
|
||||||
txs_ids.push_back(th);
|
txs_ids.push_back(th);
|
||||||
|
|
Loading…
Reference in New Issue