aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-03-19 01:07:10 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-06-14 08:48:13 +0000
commit67baa3a66b07f5b6320911eed49ca91e2a5d037a (patch)
tree199f76f90b69d7d96d5e98efa73d2afbc1c3fc4c
parentserialization: fail on read_varint error (diff)
downloadmonero-67baa3a66b07f5b6320911eed49ca91e2a5d037a.tar.xz
cryptonote: throw on tx hash calculation error
-rw-r--r--src/cryptonote_basic/cryptonote_format_utils.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cryptonote_basic/cryptonote_format_utils.cpp b/src/cryptonote_basic/cryptonote_format_utils.cpp
index 566622c1a..7d7de416d 100644
--- a/src/cryptonote_basic/cryptonote_format_utils.cpp
+++ b/src/cryptonote_basic/cryptonote_format_utils.cpp
@@ -221,8 +221,7 @@ namespace cryptonote
tx.invalidate_hashes();
//TODO: validate tx
- get_transaction_hash(tx, tx_hash);
- return true;
+ return get_transaction_hash(tx, tx_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;
get_transaction_hash(t, h, NULL);
+ CHECK_AND_ASSERT_THROW_MES(get_transaction_hash(t, h, NULL), "Failed to calculate transaction hash");
return h;
}
//---------------------------------------------------------------
@@ -1327,7 +1327,7 @@ namespace cryptonote
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);
+ CHECK_AND_ASSERT_THROW_MES(get_transaction_hash(b.miner_tx, h, bl_sz), "Failed to calculate transaction hash");
txs_ids.push_back(h);
for(auto& th: b.tx_hashes)
txs_ids.push_back(th);