aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortobtoht <tob@featherwallet.org>2026-04-22 18:06:02 +0000
committertobtoht <tob@featherwallet.org>2026-04-22 18:06:02 +0000
commit8ac6b99c9291203bb555c9d8489d43d87a332eb8 (patch)
tree3937a4611be67e0cf06601822b6da1bbbca64f8a /src
parent5f280180a8340ca61f29c320545e9b9021a4deda (diff)
parent874c771975257c82e275c17af72899b301a63d5f (diff)
downloadmonzero-core-8ac6b99c9291203bb555c9d8489d43d87a332eb8.tar.gz
monzero-core-8ac6b99c9291203bb555c9d8489d43d87a332eb8.tar.xz
monzero-core-8ac6b99c9291203bb555c9d8489d43d87a332eb8.zip
Merge pull request #10439
874c771 cryptonote_basic: pruned hash return bool (j-berman)
Diffstat (limited to 'src')
-rw-r--r--src/cryptonote_basic/cryptonote_format_utils.cpp10
-rw-r--r--src/cryptonote_basic/cryptonote_format_utils.h2
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.inl2
-rw-r--r--src/wallet/wallet2.cpp2
4 files changed, 8 insertions, 8 deletions
diff --git a/src/cryptonote_basic/cryptonote_format_utils.cpp b/src/cryptonote_basic/cryptonote_format_utils.cpp
index a6d7762ff..923ad64af 100644
--- a/src/cryptonote_basic/cryptonote_format_utils.cpp
+++ b/src/cryptonote_basic/cryptonote_format_utils.cpp
@@ -1330,10 +1330,10 @@ namespace cryptonote
return res;
}
//---------------------------------------------------------------
- crypto::hash get_pruned_transaction_hash(const transaction& t, const crypto::hash &pruned_data_hash)
+ bool get_pruned_transaction_hash(const transaction& t, const crypto::hash &pruned_data_hash, crypto::hash &res)
{
// v1 transactions hash the entire blob
- CHECK_AND_ASSERT_THROW_MES(t.version > 1, "Hash for pruned v1 tx cannot be calculated");
+ CHECK_AND_ASSERT_MES(t.version > 1, false, "Hash for pruned v1 tx cannot be calculated");
// v2 transactions hash different parts together, than hash the set of those hashes
crypto::hash hashes[3];
@@ -1350,7 +1350,7 @@ namespace cryptonote
const size_t inputs = t.vin.size();
const size_t outputs = t.vout.size();
bool r = tt.rct_signatures.serialize_rctsig_base(ba, inputs, outputs);
- CHECK_AND_ASSERT_THROW_MES(r, "Failed to serialize rct signatures base");
+ CHECK_AND_ASSERT_MES(r, false, "Failed to serialize rct signatures base");
cryptonote::get_blob_hash(ss.str(), hashes[1]);
}
@@ -1361,9 +1361,9 @@ namespace cryptonote
hashes[2] = pruned_data_hash;
// the tx hash is the hash of the 3 hashes
- crypto::hash res = cn_fast_hash(hashes, sizeof(hashes));
+ res = cn_fast_hash(hashes, sizeof(hashes));
t.set_hash(res);
- return res;
+ return true;
}
//---------------------------------------------------------------
bool calculate_transaction_hash(const transaction& t, crypto::hash& res, size_t* blob_size)
diff --git a/src/cryptonote_basic/cryptonote_format_utils.h b/src/cryptonote_basic/cryptonote_format_utils.h
index c242823c5..96059bd93 100644
--- a/src/cryptonote_basic/cryptonote_format_utils.h
+++ b/src/cryptonote_basic/cryptonote_format_utils.h
@@ -118,7 +118,7 @@ namespace cryptonote
bool calculate_transaction_prunable_hash(const transaction& t, const cryptonote::blobdata_ref *blob, crypto::hash& res);
crypto::hash get_transaction_prunable_hash(const transaction& t, const cryptonote::blobdata_ref *blob = NULL);
bool calculate_transaction_hash(const transaction& t, crypto::hash& res, size_t* blob_size);
- crypto::hash get_pruned_transaction_hash(const transaction& t, const crypto::hash &pruned_data_hash);
+ bool get_pruned_transaction_hash(const transaction& t, const crypto::hash &pruned_data_hash, crypto::hash& res);
blobdata get_block_hashing_blob(const block& b);
bool calculate_block_hash(const block& b, crypto::hash& res, const blobdata_ref *blob = NULL);
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index 6a3fd2532..5216b0d6e 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -116,7 +116,7 @@ namespace cryptonote
if (is_pruned)
{
if ((parse_success = cryptonote::parse_and_validate_tx_base_from_blob(tx_entry.blob, tx)))
- tx_hash = cryptonote::get_pruned_transaction_hash(tx, tx_entry.prunable_hash);
+ parse_success = cryptonote::get_pruned_transaction_hash(tx, tx_entry.prunable_hash, tx_hash);
}
else
{
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index cd1bc1359..9ddca04b5 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -983,7 +983,7 @@ bool get_pruned_tx(const cryptonote::COMMAND_RPC_GET_TRANSACTIONS::entry &entry,
// only v2 txes can calculate their txid after pruned
if (bd[0] > 1)
{
- tx_hash = cryptonote::get_pruned_transaction_hash(tx, ph);
+ CHECK_AND_ASSERT_MES(cryptonote::get_pruned_transaction_hash(tx, ph, tx_hash), false, "Failed to get pruned tx hash");
}
else
{